home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / c / 19159 < prev    next >
Encoding:
Internet Message Format  |  1993-01-03  |  1.3 KB

  1. Path: sparky!uunet!usc!rpi!crdgw1!rdsunx.crd.ge.com!bart!volpe
  2. From: volpe@bart.NoSubdomain.NoDomain (Christopher R Volpe)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Problem with string processing.
  5. Message-ID: <1993Jan4.010115.11393@crd.ge.com>
  6. Date: 4 Jan 93 01:01:15 GMT
  7. References: <1993Jan2.233446.20833@iitmax.iit.edu> <1993Jan3.050935.1227@news2.cis.umn.edu>
  8. Sender: volpe@bart (Christopher R Volpe)
  9. Reply-To: volpe@ausable.crd.ge.com
  10. Organization: GE Corporate Research & Development
  11. Lines: 26
  12. Nntp-Posting-Host: bart.crd.ge.com
  13.  
  14. In article <1993Jan3.050935.1227@news2.cis.umn.edu>, oleary@staff.tc.umn.edu writes:
  15. |>  
  16. |> A much better version is:
  17. |>  
  18. |> void add_char_to_str(char ch, char *str)
  19. |> {
  20. |>         char tmp[2] = {0};
  21. |>  
  22. |>         *tmp = ch;
  23. |>         strcat(str, tmp);
  24. |> }
  25. |>  
  26. |> You may even want to make tmp a static.  You could also change the name of
  27. |> the function to make it consistent with the standard string functions,
  28. |> perhaps strcharcat(char *str, char ch)
  29.  
  30. No, don't do that. Function names beginning with "str" are reserved to
  31. the implementation for future use. They are unconditionally reserved
  32. as identifiers with external linkage, and also reserved as file-scope
  33. identifiers if string.h is #included.
  34.  
  35. -- 
  36. ==================
  37. Chris Volpe
  38. G.E. Corporate R&D
  39. volpecr@crd.ge.com
  40.