Click here to Skip to main content
15,889,281 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Initialization order of globals Pin
Daniel Lohmann19-Aug-02 23:46
Daniel Lohmann19-Aug-02 23:46 
Generalquick question about CStrings Pin
ns19-Aug-02 10:54
ns19-Aug-02 10:54 
GeneralRe: quick question about CStrings Pin
Michael Dunn19-Aug-02 10:55
sitebuilderMichael Dunn19-Aug-02 10:55 
Generalthank you! Pin
ns19-Aug-02 11:08
ns19-Aug-02 11:08 
GeneralRe: quick question about CStrings Pin
Christian Graus19-Aug-02 12:34
protectorChristian Graus19-Aug-02 12:34 
GeneralRe: quick question about CStrings Pin
Ancient Dragon19-Aug-02 15:18
Ancient Dragon19-Aug-02 15:18 
GeneralRe: quick question about CStrings Pin
Christian Graus19-Aug-02 16:53
protectorChristian Graus19-Aug-02 16:53 
GeneralRe: quick question about CStrings Pin
Ancient Dragon19-Aug-02 17:38
Ancient Dragon19-Aug-02 17:38 
iostreams have their place, but often you have to resort to fread-style method (e.g. iostream->Read() ) In these cases, its just simpler to use FILE to begin with. For example, it took me a long time to determine how to write a numeric value and read it back with ostream.

ostream stream;
// open for writine not shown
int some_value = 10;
stream << some_value; // this is simple and pretty straight forward

but try to read it back fails:

istream stream;
// open for reading not shown here
stream >> some_value; // this does not work!
stream.Read(&some_value,sizeof(int)); // this works

So, I might as well have done this:

FILE *fp = fopen(...);
// write the value
fwrite( &some_value,1,sizeof(int),fp);
// now read it back
fread(&some_value,1,sizeof(int),fp);

This, to me, is a lot simple and more consistant than the preceeding iostream stuff. iostream has the advantage in writing and reading strings. But it is clumsy when working with binary data.

I might also add that I can use the same FILE pointer to read and write. Maybe I'm wrong, but I don't think you can do that with iostreams.
GeneralRe: quick question about CStrings Pin
Christian Graus19-Aug-02 17:47
protectorChristian Graus19-Aug-02 17:47 
GeneralRe: quick question about CStrings Pin
Ancient Dragon19-Aug-02 18:11
Ancient Dragon19-Aug-02 18:11 
GeneralRe: quick question about CStrings Pin
Christian Graus19-Aug-02 18:25
protectorChristian Graus19-Aug-02 18:25 
GeneralRe: quick question about CStrings Pin
Ancient Dragon19-Aug-02 23:29
Ancient Dragon19-Aug-02 23:29 
GeneralRe: quick question about CStrings Pin
Christian Graus20-Aug-02 0:35
protectorChristian Graus20-Aug-02 0:35 
GeneralRe: quick question about CStrings Pin
Chris Losinger19-Aug-02 16:56
professionalChris Losinger19-Aug-02 16:56 
GeneralRe: quick question about CStrings Pin
Christian Graus19-Aug-02 17:32
protectorChristian Graus19-Aug-02 17:32 
GeneralRe: quick question about CStrings Pin
Chris Losinger19-Aug-02 17:41
professionalChris Losinger19-Aug-02 17:41 
GeneralRe: quick question about CStrings Pin
Christian Graus19-Aug-02 18:03
protectorChristian Graus19-Aug-02 18:03 
GeneralRe: quick question about CStrings Pin
ns20-Aug-02 1:26
ns20-Aug-02 1:26 
GeneralScroll Bars Infos under W32 Pin
yarp19-Aug-02 10:35
yarp19-Aug-02 10:35 
GeneralRe: Scroll Bars Infos under W32 Pin
Tomasz Sowinski19-Aug-02 10:36
Tomasz Sowinski19-Aug-02 10:36 
GeneralRe: Scroll Bars Infos under W32 Pin
yarp21-Aug-02 21:12
yarp21-Aug-02 21:12 
GeneralRe: Scroll Bars Infos under W32 Pin
Tomasz Sowinski21-Aug-02 22:11
Tomasz Sowinski21-Aug-02 22:11 
GeneralRe: Scroll Bars Infos under W32 Pin
yarp22-Aug-02 4:47
yarp22-Aug-02 4:47 
GeneralRe: Scroll Bars Infos under W32 Pin
Neville Franks19-Aug-02 10:45
Neville Franks19-Aug-02 10:45 
Questionstress test application ? Pin
Max Santos19-Aug-02 10:26
Max Santos19-Aug-02 10:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.