delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/20/21:47:31

From: firewind <firewind AT metroid DOT dyn DOT ml DOT org>
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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Peter Palotas <blizzar AT hem1 DOT passagen DOT se> 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)            -]

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019