Re: ???

 BBS: Inland Empire Archive
Date: 11-24-92 (11:24)             Number: 317
From: DIK COATES                   Refer#: NONE
  To: PETER BARNEY                  Recvd: NO  
Subj: Re: ???                        Conf: (2) Quik_Bas
>>>> QUOTING Peter Barney to All <<<<

 PB> What the heck is \DEV\NUL\ ??

This is a reserved DOS device, the DOS encyclopedia refers to it
as a 'bit bucket' and anything written to it is discarded...

It has a real useful application... one I'd have never guessed and
is outlined in Winer's book "BASIC Techniques and Utilities" which
I've adapted and included below:


'****************************************************** FUNCTION FSINGLE2STR$
'
' Procedure returns a formatted string variable from a floating point
' (single) variable.  The variable can be a SINGLE defined in a TYPE
' variable.
'
' CALL: FSINGLE2STR$(float!, format$)
'
' ARG:  float!  - floating point variable to be converted to string
'       format$ - format required
'
' RET:  string
'
' COMP: MS Basic 7.1
'
' REV:  92-02-01
'
'****************************************************************************
'
FUNCTION FSINGLE2STR$ (float!, format$)

  filenum% = FREEFILE
  OPEN "\DEV\NUL" FOR RANDOM AS #filenum% LEN = 15
  FIELD #filenum%, 15 AS temp$
  LSET temp$ = ""
  PRINT #filenum%, USING format$; float!;
  FSINGLE2STR$ = TRIM$(temp$)
  CLOSE #filenum%

END FUNCTION' FSINGLE2STR$()


Just in passing, I've posted several snips of code from libraries I've written
in response to queries; all code I post is to be considered public domain...
Regards Dik

... Anyone see my circular tagline, it's around here somewhere -Dik
___ Blue Wave/QWK v2.10

--- Maximus 2.00
 * Origin: Durham Systems (ONLINE!) (1:229/110)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET