home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / c / 13636 < prev    next >
Encoding:
Text File  |  1992-09-14  |  743 b   |  31 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!nuug!nntp.uio.no!rujo
  3. From: rujo@ulrik.uio.no (Rune J|rgensen)
  4. Subject: sscanf and portability
  5. Message-ID: <RUJO.92Sep14160231@ulrik.uio.no>
  6. Sender: news@ulrik.uio.no (Mr News)
  7. Nntp-Posting-Host: ulrik
  8. Organization: University of Oslo, Norway
  9. Date: Mon, 14 Sep 1992 15:02:31 GMT
  10. Lines: 19
  11.  
  12. If you use types that explisit defines a byte size, e.g.:
  13.  
  14. typedef short INT16;
  15. typedef long  INT32;
  16.  
  17. INT16 i16;
  18. INT32 i32;
  19.  
  20. How do you preserve portability with sscanf? E.g:
  21.  
  22.   sscanf(s, "%hd %ld", &i16, &i32);
  23.  
  24. will work in this case, but not when long is implemented as 64 bit. (E.g.
  25. int is 32 bit, then; typedef int INT32;).
  26.  
  27. Any suggestions?
  28.  
  29. -Rune Jorgensen
  30.  rujo@ulrik.uio.no
  31.