🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #5513

Writeability of strings

#5513
From: Rich Salz
Date: Sun, 18 Dec 1988 17:27
18 lines
747 bytes
Simple question.  Which is legal and/or "safer":

	char *foo = "/tmp/xxxxxx";
	(void)mktemp(foo);

	char *foo = mktemp("/tmp/xxxxxx");

	char foo[] = "/tmp/xxxxxx";
	(void)mktemp(foo);

	#define TEMPNAME "/tmp/xxxxxx";
	char foo[sizeof TEMPNAME];
	(void)mktemp(strcpy(foo, TEMPNAME));

Thanks!
	/rich $alz
-- 
Please send comp.sources.unix-related mail to rsalz@uunet.uu.net.
Technical Details
Message-ID: <1316@papaya.bbn.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!bbn!bbn.com!rsalz

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!bbn!bbn.com!rsalz
From: rsalz@bbn.com (Rich Salz)
Newsgroups: comp.std.c
Subject: Writeability of strings
Message-ID: <1316@papaya.bbn.com>
Date: 18 Dec 88 17:27:04 GMT
Followup-To: poster
Distribution: na
Organization: BBN Laboratories Inc., Cambridge MA
Lines: 18