Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!know!samsung!uunet!mcsun!ukc!stc!rmj From: rmj@tcom.stc.co.uk (The Beardless Wonder) Newsgroups: comp.lang.c Subject: Re: how tmpname works Message-ID: <2038@islay.tcom.stc.co.uk> Date: 2 Oct 90 14:57:12 GMT References: <7372@darkstar.ucsc.edu> Reply-To: rmj@htc1.UUCP (The Beardless Wonder) Organization: STC Telecomms, Harlow Technical Centre, Harlow Lines: 24 In article <7372@darkstar.ucsc.edu> aryeh@cash.uucp (the over worked C something or another) writes: >From tmpname(3) or sunos4.1: >> char *tmpnam (s) >> char *s; >> [Rest of manual page] > >I am to assume if I call tmpname once with a NULL arg and then call it >again with a pointer to char s[...] that it will nuke the old L_tmpnam? No, but it will nuke the name string that the first call to tmpname produced (unless you have strcopied it somewhere safe first). L_tmpnam is the constant defining the minimum length that your char s[] should be. Thus an array declared as char s[L_tmpnam]; would be big enough to safely use as an argument to tmpname. As a constant, L_tmpname is not subject to nuking (well, you know what I mean). -- * Windsinger * "But soft, what light through yonder * rmj@islay.tcom.stc.co.uk * airlock breaks?" * rmj@tcom.stc.co.uk * --RETURN TO THE FORBIDDEN PLANET * rmj10@phx.cam.ac.uk * You've gotta be cruel to be Khund!