Thread: Saving Obj to Binary File

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    5

    Saving Obj to Binary File

    i got an assignment to make e-bay system in visual c++ 6.0 using gui,inherited classes and file handling....every thing is done except file handling...i tried searching and many thing but program crashes...their are lot of files so i am uploading them in .zip please see this
    help fast

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    I have not looked at your "lots of files" but the process (saving an object to a file) is called serialization and there are many ways to do it.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    5
    @MK27 yea i searched 4 this term...the problem am getting is their are 3 different classes arrays in another class "nushop",,, now when i save object of nushop in file and read it again,,,its not getting correct values of data in those arrays,,,(but data of "nushop" is correctly readable)...any help ???
    arrays are like:
    bid bids[10];
    item items[100];
    user users[100];

    p.s sry 4 my bad english am not native speaker

  4. #4
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    Location
    segmentation fault
    Posts
    8,300
    The problem is, very few (if any) people here are actually going to download your whole program and look at it. And the problem you are describing should not require that, either. If you want help, unfortunately it is you that will have to make an effort to get it; simply throwing everything up and saying "it doesn't work" probably won't get much attention.

    But if you relax and try to describe your problem in concise, concrete terms, with snippets of code and output to illustrate, you will have better luck.

    Quote Originally Posted by j_d View Post
    when i save object of nushop in file and read it again,,,its not getting correct values of data in those arrays,,,(but data of "nushop" is correctly readable)
    Could be a few things. Post the class definition for ONE (the smallest) of those classes together with the declaration (header) for nushop, and explain how exactly you are serializing them.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

  5. #5
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    program crashes
    Compile in debug mode
    Run program in debugger
    On crash debugger stops
    Evaluate variables/program state

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Saving map to binary file.
    By Qrypt in forum Game Programming
    Replies: 2
    Last Post: 04-14-2011, 03:03 AM
  2. Saving Struct to Binary File/Copying Structs
    By timmeh in forum C++ Programming
    Replies: 1
    Last Post: 10-07-2009, 08:44 PM
  3. Saving linked lists to a binary file
    By kotoko in forum C Programming
    Replies: 1
    Last Post: 06-14-2008, 06:41 PM
  4. saving a CString to binary file with trailing spaces
    By nineofhearts in forum C++ Programming
    Replies: 12
    Last Post: 01-03-2006, 11:53 AM
  5. Saving in binary
    By bigdan43 in forum C++ Programming
    Replies: 1
    Last Post: 04-06-2005, 03:23 PM