Thread: ios::binary.... a discussion (mostly)

  1. #16
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    The output I get :

    --------------
    Name=ginoitalo
    Date=9
    Phone=13281
    --------------

    End of file = 88
    Size of applicant = 88

    Records in file=1

    --------------
    Name=ginoitalo
    Date=9
    Phone=13281
    --------------

    So, why aren't we getting the same output ?

    I'm interested

  2. #17
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    Now your second version runs fine, Im not basing you but your first one didnt work, evident by the screen i posted. On some systems if you try to read from a fstream object that was declared as in and out then it will mess up and read garbage.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  3. #18
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    That's odd,
    since fstream is ostream & ifstream
    I guess in theory it should work fine
    but (as always) in testing it doesn't always pan out.

    Nice Post Everyone

  4. #19
    Registered User xds4lx's Avatar
    Join Date
    Nov 2001
    Posts
    630
    In a perfect implementation it should, but when you are talking about microsoft then you shouldnt have high expectations and expect full functionality.
    "only two things are infinite, the universe and human stupidity, and im not sure about the former." - albert einstein

  5. #20
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102

    Question

    If I wanted to save a STL map object in binary format and then when the program is run later how would my program tell how many bytes to read in? Would I have to right a int to difine how many bytes then write my map to file so that I could read the size of the map back in so I'd know what size of map was going to be?
    Would that work and/or is there an easier way?
    WebSnozz-
    Cats have no butt cheeks.
    If one farted, then it would make a flute noise.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. instantiation point discussion
    By George2 in forum C++ Programming
    Replies: 1
    Last Post: 03-08-2008, 03:48 AM
  2. Terrain Screenshot and Discussion
    By Epo in forum Game Programming
    Replies: 28
    Last Post: 01-20-2006, 08:26 PM
  3. A Good Discussion - Stay on Topic
    By DavidP in forum A Brief History of Cprogramming.com
    Replies: 71
    Last Post: 04-28-2004, 08:52 AM
  4. enlightening discussion...
    By no-one in forum A Brief History of Cprogramming.com
    Replies: 48
    Last Post: 04-24-2004, 03:27 PM
  5. Slogan for a discussion board for Programmers of Bangladesh
    By zahid_isback in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 04-20-2004, 01:38 AM