class output

This is a discussion on class output within the C++ Programming forums, part of the General Programming Boards category; is it possible to write objects directly to files (like it is possible in Java) or do you need to ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    11

    class output

    is it possible to write objects directly to files (like it is possible in Java) or do you need to write all the objects elements, one by one, to the file?
    I use BorlandBuilder 5

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    yes it is possible. But it requires a little work. You have to overload operator << and operator >> for your class to write to ofstream and read from ifstream.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    11
    thanks for the answer!

    now it's back to the books...........
    I use BorlandBuilder 5

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Weird, cards not outputting correctly
    By Shamino in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2007, 02:26 PM
  2. deriving classes
    By l2u in forum C++ Programming
    Replies: 12
    Last Post: 01-15-2007, 04:01 PM
  3. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 10:03 PM
  4. Displaying my glut output in my own class window.
    By Queatrix in forum Windows Programming
    Replies: 0
    Last Post: 10-19-2005, 10:09 AM
  5. gcc problem
    By bjdea1 in forum Linux Programming
    Replies: 13
    Last Post: 04-29-2002, 06:51 PM

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