End of File Character

This is a really silly C++ question and im embarassed to ask it, but I cant seem to figure out how to stop it.  I have an output file that i am outputting some CStrings.  When it outputs the CStrings and gets to the last one, my program outputs and end of file character that looks like a 'y' with two dots over it.  So when i read in that file the next time, it reads in that y.  My input file reads in until it gets to the eof character so that is ok, but i dont want the eof character to be visible upon output. How can i do this?Thanks!!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jan LouwerensSoftware EngineerCommented:
can you post your code?
feel free to ask any tech question, epastoor
i met the same problem months ago, but i forgot how to solve it
i will read my code and try to help you
i am also willing to hear experts' idea about it, coz i am not sure my solution is right

BTW, wait for your code first
You should open the file in binary mode.  If the file is in text mode, the end of file character may be appended automatically when the file is closed.

I'm not sure how you are opening the file, but most likely you are using a fstream objects, if so, just ios::binary in the mode parameter (2nd parameter) of the fstream's constructor.

Let me know if you have any questions.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
epastoorAuthor Commented:
Correct..i am using fstream
i tried adding the binary command and it completely deleted my input file. when my program loads up, i load each string in the input file, string by string.  
here is how i am currently opening the file
fstream inFile;
inFile.open("file.txt", ios::in |ios::out);

any thoughts to what else i could try  so that it didnt print out that character?

Sorry, I did not respond earlier.  I've had terrible computer problems and have been unable to access the internet for over a week!  What's more I am now goign away for a week.  Sorry.

Try adding the ios::app  (append) flag, like

inFile.open("file.txt,ios::in | ios::out | ios::app);

If that doesn't help (it will, but you might have other problems too), I will be back on January 2nd.

sorry again
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.