Article View: comp.arch
Article #13314Re: String Processing Instruction
From: rbutterworth
Date: Sat, 28 Mar 1987 23:15
Date: Sat, 28 Mar 1987 23:15
16 lines
1249 bytes
1249 bytes
In article <15317@amdcad.UUCP>, rpw3@amdcad.UUCP (Rob Warnock) writes: > I find myself doing: > char *p = &buf[0]; > int n; > strcpy(p, "piece"); p += strlen(p); > strcpy(p, "another piece"); p += strlen(p); > sprintf(p, "format%d%s", args...); p+= strlen(p); > strcpy(p, "still another piece"); p += strlen(p); > etc... Wouldn't it have been nice if strcpy(), strcat(), sprintf(), etc. had been designed to return a pointer to the END of the string, (or a count of the number of characters in the string)? They already have this information for free, but instead they return their first argument, something that the caller already knows.
Technical Details
Message-ID:
<6448@watmath.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!rbutterworthReferences:
<15292@amdcad.UUCP> <978@ames.UUCP> <15304@amdcad.UUCP> <15317@amdcad.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watnot!watmath!rbutterworth From: rbutterworth@watmath.UUCP Newsgroups: comp.arch,comp.lang.c Subject: Re: String Processing Instruction Message-ID: <6448@watmath.UUCP> Date: Sat, 28-Mar-87 18:15:43 EST Article-I.D.: watmath.6448 Posted: Sat Mar 28 18:15:43 1987 Date-Received: Sun, 29-Mar-87 03:34:38 EST References: <15292@amdcad.UUCP> <978@ames.UUCP> <15304@amdcad.UUCP> <15317@amdcad.UUCP> Distribution: na Organization: U of Waterloo, Ontario Lines: 16 Keywords: strlen strcmp strcpy