View Single Post
Old Dec 10th, 2005, 6:08 PM   #5
Intimidat0r
Hobbyist Programmer
 
Intimidat0r's Avatar
 
Join Date: May 2005
Location: Don't know, but the padded walls are a nice touch.
Posts: 126
Rep Power: 0 Intimidat0r is an unknown quantity at this point
Send a message via ICQ to Intimidat0r Send a message via AIM to Intimidat0r Send a message via MSN to Intimidat0r Send a message via Yahoo to Intimidat0r
I'm sorry, I forgot to post string_copy()'s definition:

string string_copy(string source, int startpos, int length)
{
	string final;
	final = "";
	
	for (int i = startpos; i <= length; i++)
		final += source[i];
	
	return final;
}

the idea with that function is to return a 'length' substring of 'source', starting at 'startpos'.

the idea of all this was to take a string containing several lines, each seperated by a newline (\n) and put each line into a seperate element of the array statements.

the variable last_flushed is so it puts a substring of 'code', between last_flushed (the end of the last string put into the array) and i (the position of the next \n) and not everything from the beginning to whatever newline it encounters.

@coldDeath: size() is a member of std::string. code.size() returns the length of the string 'code'.
__________________
Children in the dark cause accidents, and accidents in the dark cause children.

http://www.ronincoders.org
Intimidat0r is offline   Reply With Quote