home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!rpi!crdgw1!rdsunx.crd.ge.com!bart!volpe
- From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
- Newsgroups: comp.lang.c
- Subject: Re: Problem with string processing.
- Message-ID: <1993Jan4.010115.11393@crd.ge.com>
- Date: 4 Jan 93 01:01:15 GMT
- References: <1993Jan2.233446.20833@iitmax.iit.edu> <1993Jan3.050935.1227@news2.cis.umn.edu>
- Sender: volpe@bart (Christopher R Volpe)
- Reply-To: volpe@ausable.crd.ge.com
- Organization: GE Corporate Research & Development
- Lines: 26
- Nntp-Posting-Host: bart.crd.ge.com
-
- In article <1993Jan3.050935.1227@news2.cis.umn.edu>, oleary@staff.tc.umn.edu writes:
- |>
- |> A much better version is:
- |>
- |> void add_char_to_str(char ch, char *str)
- |> {
- |> char tmp[2] = {0};
- |>
- |> *tmp = ch;
- |> strcat(str, tmp);
- |> }
- |>
- |> You may even want to make tmp a static. You could also change the name of
- |> the function to make it consistent with the standard string functions,
- |> perhaps strcharcat(char *str, char ch)
-
- No, don't do that. Function names beginning with "str" are reserved to
- the implementation for future use. They are unconditionally reserved
- as identifiers with external linkage, and also reserved as file-scope
- identifiers if string.h is #included.
-
- --
- ==================
- Chris Volpe
- G.E. Corporate R&D
- volpecr@crd.ge.com
-