home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1253 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.cc.ic.ac.uk!not-for-mail
  2. From: nagd@doc.ic.ac.uk (Nicholas d'Alterio)
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: Re: Function like UPPER but ANY in C ?
  5. Date: 17 Jan 1996 08:35:54 GMT
  6. Organization: Imperial College, London, UK
  7. Message-ID: <4dicda$11c@oban.cc.ic.ac.uk>
  8. References: <30fb3b91@beachyhd.demon.co.uk>
  9. NNTP-Posting-Host: oak45.doc.ic.ac.uk
  10. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  11.  
  12. Adam@beachyhd.demon.co.uk wrote:
  13. : In a message of 14 Jan 96 Roland Bengtsson wrote to All:
  14. :  RB> I don't know what you mean with ANY but if you want to convert a
  15. :  RB> character to uppercase you can clear the fifth bit like this:
  16. :  RB> #define UPPER(a) (a&(~32))
  17. :  RB> /* in use */
  18. :  RB> int i
  19. :  RB> char str[10] = "Example";
  20. :  RB> for(i=0;str[i];i++)
  21. :  RB>         str[i] = UPPER(str[i]);
  22. : Be careful the character /is/ a alpha character, though. Otherwise "{Example}"
  23. : becomes "[EXAMPLE]" -- not quite what you were after..
  24. : .\dam.          [Team AMIGA]          //\ ad32@brighton.ac.uk \\/
  25.  
  26. How about the ANSI C function toupper defined in ctypes.h
  27.  
  28. -- 
  29.  
  30. ~=====================================================~
  31.   Nicholas d'Alterio - Msc student Computing Science
  32.             Imperial College, London
  33.   E-Mail: nagd@ic.ac.uk or daltern@ic.ac.uk (closing)
  34.   http://crab.sp.ph.ic.ac.uk/~projects/nick_gid/nick/
  35. ~=====================================================~
  36.