Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Technical Support » Other » new fds bot, c++ php, perl
Re: new fds bot, c++ php, perl [message #208554 is a reply to message #207285] Mon, 17 July 2006 13:45 Go to previous messageGo to previous message
jnz is currently offline  jnz
Messages: 3396
Registered: July 2006
Location: 30th century
Karma:
General (3 Stars)
i have run into another problem, i have programmed my bot so far to get the date, open the file ssaow_<month>-<day>-<year>.txt read it delete it, print it out. it works when i put the file there myself. but not when i put it in the server dir why is this?
here is some code:
bool find_new_text(string &line)
{
	string st;
	string day, mon, year;
	get_date(day, mon, year);
	st.assign("ssaow_"+mon+"-"+day+"-"+year+".txt");
	ifstream file;
	file.open(st.c_str(), ios::in);
	char buf[50];
	if(file.is_open())
	{
		file.getline(buf, 50);
		line.assign(buf);
		file.close();
		unlink(st.c_str());
		return 1;
	}
	else
	{
		return 0;
	}
	return 0;

}
void pre_parse()
{
	string find;
	while(1)
	{
		if(find_new_text(find))
		{
			parse(find);
			find.clear();
		}
	}
}
void parse(string line)
{
	stringstream strs;
	int f = 11;
	while(f != line.size())
	{
		strs << line[f++];
	}
	cout << endl << strs.str();
}


parse() at the moment removes 11 chars from the beggining of the string and prints it.

pre_parse() is the function called;

the debug error i get is:

Debug Assertion Failed

Program: C:\Westwood\RenegadeFDS\Server\bot.exe
File: .\string
Line: 1508

Expression: string subscript out of range

why would it do this if i create the file manually and it works?
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Can some1 help me
Next Topic: German Need help
Goto Forum:
  


Current Time: Wed Dec 04 14:11:45 MST 2024

Total time taken to generate the page: 0.01422 seconds