delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/16/19:41:53

Date: Thu, 16 Oct 1997 16:40:10 -0700 (PDT)
Message-Id: <199710162340.QAA04774@adit.ap.net>
Mime-Version: 1.0
To: Georg DOT Kolling AT t-online DOT de (Georg Kolling), djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: sprintf() string length?

At 09:17  10/16/1997 DST, Georg Kolling wrote:
>Peter Palotas schrieb:
>> >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!
>> -- Peter Palotas alias Blizzar -- blizzar AT hem1 DOT passagen DOT se --
>
>NUL (yes, with one L) is neither a file nor a pointer, it's a DOS device driver
>(like CON, PRN, AUX and $CLOCK) but it can be used like a file. Its only task
>is to do nothing... sounds strange! I don't know if a similar thing exists in
>other OSs.
It does, and actually is quite useful. Under Unix you have `/dev/null',
which DJGPP emulates, as somebody else said. It's useful for cases like
this: You have a program which produces some huge output that you don't
actually want to see. You can redirect to the null device and ignore it
completely. It's basically a bit bucket. (Unix also has /dev/zero, which
also discards writes to it but gives you zeros when you read. This is useful
for filling a file with zeros.)

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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