Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rlgvax.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!rlgvax!guy From: guy@rlgvax.UUCP (Guy Harris) Newsgroups: net.lang.c Subject: Re: String help! (getting ANSI C strings back out of ROM) Message-ID: <585@rlgvax.UUCP> Date: Wed, 20-Mar-85 00:26:02 EST Article-I.D.: rlgvax.585 Posted: Wed Mar 20 00:26:02 1985 Date-Received: Thu, 21-Mar-85 03:13:25 EST References: <1156@ukma.UUCP> <113@mit-athena.UUCP> <573@rlgvax.UUCP> <2181@pegasus.UUCP> Organization: CCI Office Systems Group, Reston, VA Lines: 26 > By definition, in ANSI C (according to the latest Feb. draft) string > constants are of type "const char[]". The first horrified thought that > comes to the mind of many UNIX programmers is "What do I do with all of my > calls to mktemp() now?" Easy! > > mktemp ("/tmp/fooXXXXXX"); > > becomes > > mktemp ( (char *) "/tmp/fooXXXXXX"); Even better, it becomes char tempstr[14+1]; strcpy(tempstr, "/tmp/fooXXXXXX"); mktemp(tempstr); which can, unlike mktemp("/tmp/fooXXXXXX"); be executed more than once and work every time. -- Guy Harris {seismo,ihnp4,allegra}!rlgvax!guy