Needing a little help - Problem with Files
Posted: Fri Feb 09, 2007 1:26 pm
Hi All,
I searched through google but couldn't find an answer. My doubt is how to put the EOF mark in any place of a file. What I'm supposing seems like to put a NULL mark ('\0') in the middle of a string in order to "eliminate" all the others characters after it.
Example:
You have these data on a input file:
Now, I have to make a program to eliminate the last number and save the output in the same file as the input. In other words, if I use the above input file in my program, the input file after it ran should be:
Obviously, I eliminated the last number (10).
The real problem is that I wanted just to move the EOF mark before the number 10, so I eliminate it. This would be the output of my program
which in my mind would finally result in
The problem of eliminating the last number was just an example. What I really want to know is if I can move the EOF mark to any place in a file.[/code]
thanks in advance and forgive me if I did any english mistake
I searched through google but couldn't find an answer. My doubt is how to put the EOF mark in any place of a file. What I'm supposing seems like to put a NULL mark ('\0') in the middle of a string in order to "eliminate" all the others characters after it.
Example:
You have these data on a input file:
Code: Select all
1 2 3 4 5 6 7 8 9 10 <EOF>
Code: Select all
1 2 3 4 5 6 7 8 9 <EOF>
The real problem is that I wanted just to move the EOF mark before the number 10, so I eliminate it. This would be the output of my program
Code: Select all
1 2 3 4 5 6 7 8 9 <EOF> 10
Code: Select all
1 2 3 4 5 6 7 8 9 <EOF>
thanks in advance and forgive me if I did any english mistake
