03.12.2010, 20:11
Okay so i would require to identify a line, then remove that specific line from the txt file?
new aLineFromTheFile[256];
new File:f = fopen("file.txt", io_read);
new File:temp = fopen("temp.txt", io_write);
while (fread(f, aLineFromTheFile))
{
if (strcmp (aLineFromTheFile, "The line I want") == 0)
{
printf("This line won't get written in the temp file");
continue;
}
fwrite(temp, aLineFromTheFile);
}
fclose(f);
fclose(temp);
//rewriting the original file with the temp one
f = fopen("file.txt", io_write);
temp = fopen("temp.txt", io_read);
while (fread(temp, aLineFromTheFile))
{
fwrite(f, aLineFromTheFile);
}
Fremove("temp.txt");