I don't think '\n' is the problem. The issue is how to make a line when using a pointer (For example, wordText - which is a string, and then a code to tell the engine to drop to the next line). When I was using python, it was simply a matter of adding +"\n", which doesn't work with lite-c. If someone has info on this, I would be glad to have it.

Anyway... Great News! I found the solution! A simple way to delete a line in the file by copying of course.

Here's the code:


Code:
//Don't forget to declare the variables.

action recheck() //******THIS IS NOT IMPORTANT - just to see if I could use the copy.
{
	myFile = file_open_append(fileStringCopy);
	if(myFile == 0) {fileOpen = 0;}
	else
	{
		fileOpen = 1;
		var i;
		for (i=0; i<lineToRead; i++)
		{
			file_str_read(myFile,WordText);
			str_cpy((testing.pstring)[0], WordText);
		}
		file_close(myFile); fileOpen = 0;
	}
}

action replaceFile()
{
	myFile1 = file_open_read(fileString); //open file 1
	myFile2 = file_open_append(fileStringCopy); //open file 2
	if (myFile1 == 0) {fileOpen = 0;}
	var ii = 0;
	var skipLine = 0;
	while (ii < 91)
	{
		ii += 1;
		//when the line is reached...
		if (skipLine == 0 && ii == lineToRead) {skipLine = 1;} //...indicate
		file_str_read(myFile1,WordText); //read a line from file 1
		if (skipLine != 1) //as long as the line is not read...
		{
			str_cpy(newString,WordText); //...copy
			file_str_write(myFile2,newString); //...write a line to file 2
			file_str_write(myFile2,","); //place a comma after
		}
		str_cpy((testing.pstring)[0], newString); //check word on screen
		if (skipLine == 1) {skipLine = 2;} // indicate that the line is read
		if (ii >= 91) //when all lines are read...
		{
			file_close(myFile1); //close files
			file_close(myFile2);
			fileOpen = 0; 
			ent_remove(me); //remove temporary entity
			temp = ent_create("mark.mdl",vector(0,0,0),recheck);
			break; //stop the loop
		}
		wait(1);
	}
}

action copyFile() //******THIS IS NOT IMPORTANT - just a copy to string
{
	myFile = file_open_read(fileString);
	if(myFile == 0) {fileOpen = 0;}
	var i = 0;
	while (i < 91)
	{
		file_str_read(myFile,WordText);
		str_cat(newString,WordText); //copy the entire file to a string
		str_cat(newString,",");
		str_cpy((testing.pstring)[0], WordText);
		i += 1;
		if (i >= 91) 
		{
			file_close(myFile);
			fileOpen = 0; 
			ent_remove(me); //remove temporary entity
			temp = ent_create("mark.mdl",vector(0,0,0),replaceFile);
			break;
		}
		wait(1);
	}
}

//Get the word in the line
myFile = file_open_read(fileString);
if(myFile == 0) {fileOpen = 0;}
else
{
	fileOpen = 1;
	var i;
	for (i=0; i<lineToRead; i++)
	{
		file_str_read(myFile,WordText);
		str_cpy((Word.pstring)[0], WordText);
		str_cpy(theWord,WordText);
	}
	file_close(myFile); fileOpen = 0;
	temp = ent_create("mark.mdl",vector(0,0,0),copyFile);
}



In order to just use two files for copying, I copy the original using 'file_cpy', and use that file to read from (file 1). After the second file has been created (file 2), I clear file 1 by using 'file_open_write ("")'. It should be empty now, so then I can use that to copy from file 2. So I would be copying back and forth between those two files.
I feel good about this, because now I have a better feel on using files. I'm still interested in dropping a line though. It's not so important now, but it might come in handy later. So if anyone has some input, please post it. Thanks for all the help.

Last edited by JGGamer; 01/18/10 04:57.