Thread: Store A class

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    45

    Question Store A class

    Is it possible to store a whole class with all his variables and stuff in A file, so I can get it later back(would be handy if I can also a number to it), it is for making a datbase program..

  2. #2
    Registered User The Dog's Avatar
    Join Date
    May 2002
    Location
    Cape Town
    Posts
    788
    Yes, what you have to do is write the object to the file in binary, then read the object from the file in binary.

    Be careful though, if your class has pointers as fields, then when you read in the object from the file, those pointers will most probably be pointing to memory that you don't want it to be pointing at.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with FIFO QUEUE
    By jackfraust in forum C++ Programming
    Replies: 23
    Last Post: 04-03-2009, 08:17 AM
  2. Replies: 8
    Last Post: 10-02-2005, 12:27 AM
  3. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM