Store A class

This is a discussion on Store A class within the C++ Programming forums, part of the General Programming Boards category; Is it possible to store a whole class with all his variables and stuff in A file, so I can ...

  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, 06:18 AM
  5. Abstract class problem
    By VanJay011379 in forum C++ Programming
    Replies: 9
    Last Post: 07-31-2002, 01:30 PM

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