tellp, tellg, seekp, seekg
-
Hi I've used files long time ago in C++. I guess there is a certain new convention for using files in Visual C++ 2005, I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg. Is there any new class which I should use or any other method ? I want still to work unmanaged not using the functions of system.dll which are used in .NET. Thanks, Clint
-
Hi I've used files long time ago in C++. I guess there is a certain new convention for using files in Visual C++ 2005, I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg. Is there any new class which I should use or any other method ? I want still to work unmanaged not using the functions of system.dll which are used in .NET. Thanks, Clint
clint1982 wrote:
I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg.
What do you get? Expect?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
clint1982 wrote:
I am using the class fstream with binary files and I don't get the right file position when using tellp and tellg.
What do you get? Expect?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
well, I write bytes into a file, I seek to the end of the file and call (tellp or tellg) after flushing the stream, and get 2 as an answer. But if I close the file, I see that the size of the file is 188. So I expect that the answer would be 188. Clint