From: firewind Newsgroups: comp.os.msdos.djgpp Subject: Re: sprintf() string length? Date: 18 Oct 1997 00:02:16 GMT Organization: Netcom Lines: 28 Message-ID: <628ua8$h4t@sjx-ixn9.ix.netcom.com> References: <3 DOT 0 DOT 16 DOT 19971016132047 DOT 34a756c4 AT hem1 DOT passagen DOT se> NNTP-Posting-Host: elp-tx3-24.ix.netcom.com Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Peter Palotas wrote: > At 09.53 1997-10-16 +0100, you wrote: > >I once read a solution to this (can't remember where though!): > > > >The "fprintf" command will return the number of characters output, > >and you should fopen DOS's "NULL" file to send the output to. > >"NULL" is a "black hole" which will swallow and ignore anything you > >send to it. Although "NULL" never appears in a directory, it > >exists everywhere. (I think the UNIX equivalent is "/dev/nul", > >but I've never used UNIX.) > Does anyone know if this works, and how compatible it is? > Writing to a NULL pointer doesn't sound too good to me! This will work on any filesystem that offers a "bit-bucket." Writing to "/dev/null" will work on all Unix and Unix-alike operating systems, including DJGPP. Writing to "NUL" will work on all Microsloth OS's, with the possible exception of NT. You aren't writing to a NULL -pointer-; you're writing to a file (called "NUL" under DOS, whence comes your confusion, perhaps?). -- [- firewind -] [- email: firewind AT metroid DOT dyn DOT ml DOT org (home), firewind AT aurdev DOT com (work) -] [- "You're just jealous because the voices talk to -me-." -] [- Have a good day, and enjoy your C. -] [- (on a crusade of grumpiness where grumpiness is due) -]