www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/16/04:14:59

Date: Tue, 16 Sep 1997 16:13:06 +0800 (GMT)
From: Orlando Andico <orly AT dilnet DOT upd DOT edu DOT ph>
To: David Lenk <lenkd AT pltpub DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: how do i do this
In-Reply-To: <5vkqrg$ua@bgtnsc02.worldnet.att.net>
Message-ID: <Pine.SGI.3.93.970916161228.10096A-100000@gibson.eee.upd.edu.ph>
MIME-Version: 1.0

On 16 Sep 1997, David Lenk wrote:

..
> anyways, I need a small program that will make a random 8.3 format text
> file (8.3 refers to the dos standard file length).  The name generated
> would then have to be stored in a variable so that it could be used in a
> 'fprintf' command.  I know how to write the file using fprintf but I have
> no ideal of how to generate the random name.  I have tried to make the
> filename a random number but the program crashes with a GPF, and during
> compilation i get pointer errors.

use the tmpnam() function:

 #include <stdio.h>
 char *tmpnam (char *s)

which is designed exactly to produce a random filename.

-------------------------------------------------------------------
Orlando Alcantara Andico
WWW:   http://www2.mozcom.com/~orly/         Email: orly AT mozcom DOT com
ICBM:  14 30 00 N  120 59 00 E               POTS:  (+632) 932-2385

- Raw text -


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