ifstream errors

Started by
11 comments, last by ironfroggy 22 years, 8 months ago
It means that you''re passing an empty string to the stream as the filename, which isn''t allowed.
Advertisement
ok ive got the file to open correctly now it seems
but it still wont read the file. i am using ifstream::get() to put the data into ch (iFile.get(ch)) but ch doesnt seem to get a new value after i call get()
(http://www.ironfroggy.com/)(http://www.ironfroggy.com/pinch)
quote:Original post by ironfroggy
I got the code from a friend, he said for text files used the ios::trunc argument. Also, the file is cleared after the program runs.

Trunc will clear the file when you open it, cos that''s what it''s there for. So you''ll never be able to read anything from it if you keep removing its contents beforehand. You don''t want trunc when you just want to read. By the way, trunc shouldn''t work without the out flag too, so perhaps you''re setting it or something.

This topic is closed to new replies.

Advertisement