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

This is a discussion on filestreams (fstream) and standard input/output (stdlib) within the C++ Programming forums, part of the General Programming Boards category; Okay, I am in a bind. I am trying to write steps to read in any type of file under ...

  1. #1
    Shadow12345
    Guest

    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
    Location
    Sweden
    Posts
    3,145
    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.
    MagosX.com

    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
    Shadow12345
    Guest
    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
    Posts
    44

    Cool

    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
    Shadow12345
    Guest
    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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21