RE: [Dev-C++] Is there a "garbage" stream?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-11-09 03:57:47
|
> -----Original Message----- > From: dev...@li... > [mailto:dev...@li...] On Behalf > Of Scott Williams > Sent: Thursday, November 07, 2002 10:27 PM > To: Dev-Cpp-Users@Lists. Sourceforge. Net > Subject: [Dev-C++] Is there a "garbage" stream? > > > Hi, > > Here's my problem. I have C code that does a bunch of number > crunching, > spitting out intermediate results to the output files along the way. > However, in some applications, it would be preferable to NOT > write any data > to output files (e.g., when the program is run iteratively in > an nonlinear > optimization routine). > > Rather than hunt through my code to find all the instances of > fprintf(fpout, > ...) and insert a conditional statement, it would be much easier (and > cleaner) if I could simply initialize the file pointer to a > stream going > nowhere. > > I've tried setting fpout = NULL but that doesn't work. Any > suggestions? There is not in standard C. However an implementation may provide one as a system extension. Also you can use a predefined one like stdout or stderr (so as to not write to a file). Ioannis Vranos * Programming pages: http://www.noicys.freeurl.com * Alternative URL: http://run.to/noicys |