   C++ equivalent?
  Is there a function or class in C++ that does exactly what C''s fread / fwrite does with structs? Thanks! 
  the istream::read() and ostream::write() functions are probably what you need. They each have versions that operate on a character array, so you can just cast your struct pointer to a char pointer and go wild.EDIT: whoops. Yeah."Sneftel is correct, if rather vulgar." --Flarelocke [edited by - sneftel on February 3, 2004 5:06:34 PM];  std::istream::readstd::ostream::write ;  Technically fread() and fwrite() are part of the C++ standard library too.However, I'm guessing that get() and put() are *not* what you're looking for. The two paramter version of get() has an implicit \n delimeter. And ostream::put() only writes one character at a time.edit: @!$% smily code   [edited by - SiCrane on February 3, 2004 5:05:10 PM];  Thanks, but how can I use read to output a struct? ;  ^^ I mean write ;quote:Original post by Sneftel  EDIT: whoops. Yeah.Sure just edit my post into a non sequitur AP: If you know how to use fwrite() to output a struct, you should have no trouble using basic_ostream::write(). ;  http://www.cplusplus.com/ref/iostream/ostream/write.htmlThis definition allows a string and a byte size. fwrite allows a void * buffer which allows a struct. Sorry, but I''m confused on how to use it. ;quote:Original post by Anonymous Poster  http://www.cplusplus.com/ref/iostream/ostream/write.htmlThis definition allows a string and a byte size.A char * is a pointer, not a string. When a buffer of memory''s initial address offset is cast to char *, sequential access is byte-wise (because the size of a char is typically a byte). So cast the address of your struct to char * and pass it to write.Learn your pointers. ;  OK, I got it working. Thanks for the help! 