About #8 (backspace)

I have a word in a text file that I want to erase. It appears that the function Seek doesn't work for text files. So, I found that #8 is the ASCII code for backspace. The problem is that when I use Write(file, #8) or Write(file, #8, ' ', #8) Notepad shows a strange icon in the file, and the word remains in the file.

Comments

: I have a word in a text file that I want to erase. It appears that the function Seek doesn't work for text files. So, I found that #8 is the ASCII code for backspace. The problem is that when I use Write(file, #8) or Write(file, #8, ' ', #8) Notepad shows a strange icon in the file, and the word remains in the file.: The #8 character is seen as a normal character when placed in a file. To delete a word from a text file, you need to copy the file without the word in question into a new file. Here is an example, which removes all words "the":[code]var sf, df: textfile; s: string;begin Assign(sf, 'source.txt'); Reset(sf); Assign(df, 'dest.txt'); Rewrite(df); while not eof(sf) do begin readln(sf, s); { read a line } while Pos('the', s) > 0 do { remove all "the"s from the line } Delete(s, Pos('the', s), 3); writeln(df, s); { write it to the new file } end; Close(df); Close(sf);end;[/code]

: : I have a word in a text file that I want to erase. It appears that the function Seek doesn't work for text files. So, I found that #8 is the ASCII code for backspace. The problem is that when I use Write(file, #8) or Write(file, #8, ' ', #8) Notepad shows a strange icon in the file, and the word remains in the file.: : : The #8 character is seen as a normal character when placed in a file. To delete a word from a text file, you need to copy the file without the word in question into a new file. Here is an example, which removes all words "the":: [code]: var: sf, df: textfile;: s: string;: begin: Assign(sf, 'source.txt');: Reset(sf);: Assign(df, 'dest.txt');: Rewrite(df);: while not eof(sf) do: begin : readln(sf, s); { read a line } : while Pos('the', s) > 0 do { remove all "the"s from the line }: Delete(s, Pos('the', s), 3);: writeln(df, s); { write it to the new file }: end;: Close(df); : Close(sf);: end;: [/code]: Thanks for the help