Thread: filestreams (fstream) and standard input/output (stdlib)

  1. #1

    filestreams (fstream) and standard input/output (stdlib)

    Okay, I am in a bind. I am trying to write steps to read in any type of file under windows. I am just beginning so I haven't really gotten into it yet. What are the differences between using filestreams supplied by the fstream library and using fread from the stdio library?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    One is C and one is C++ .

    The only difference I've seen is that C++ is better/easier when reading/writing text files and C is better/easier when reading/writing binary files. But that's me.

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Ok so I take it fstream is C and fread is C++ (fread must be C++ if it is a part of stdlib, right?). Is it true that if you know the format of the file then you can read in the binary and assign the appropriate parts to data structures? This is under windows btw (although it would probably work on other platforms). What I am getting at is you can potentially use any format that exists on your system if you know how to use it correctly.

  4. #4
    Registered User 4point5's Avatar
    Join Date
    Oct 2002


    Yeah, the only way a file is defined is by the program that opens it.

    Does that even make sense? It's too early...
    Don't try so hard. Just let it happen.

  5. #5
    Yes I guess that makes sense, because until a programmer writes a program that uses all of those 1's and 0's it means nothing.

    I am finding that with all of these 3d modeling programs you can actually open up the files in notepad or textpad or some editor and you can try and figure out what the content means.

    This is really cool.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. ARGH! fstream errors
    By OttoDestruct in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2004, 10:37 PM