View Full Version : can you use fstream in linux?

12-12-2002, 09:10 PM
specifically this type of file i/o:

ifstream aFile ("blah", ios::binary)

i don't actually have linux and i know nothing about it and can't test it, i just want to leave the option open in the future to port my program to linux.

12-12-2002, 11:28 PM
Yes, you can use ifstream in linux. At work I had a problem using ios::binary on Unix, since all files are treated as binary. I assume you may find the same problem. Use a conditional define to test for the operating system, eg :

#ifdef _LINUX_
ifstream aFile ("blah");
ifstream aFile ("blah", ios::binary);

12-13-2002, 12:40 AM
why not just use the C defined file streams?

12-14-2002, 05:57 PM
Originally posted by Lynux-Penguin
why not just use the C defined file streams?

... The obvious answer: Maybe he's programming in C++.