| delorie.com/archives/browse.cgi | search |
| From: | Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Separating two 8bit numbers from 16bit |
| Date: | Tue, 21 Apr 1998 14:41:27 +0200 |
| Organization: | University of Ghent, Belgium |
| Lines: | 20 |
| Message-ID: | <353C93F7.7055@rug.ac.be> |
| References: | <6hi14m$e2o$1 AT hiisi DOT inet DOT fi> <353C9228 DOT 4A6A0300 AT a DOT crl DOT com> |
| NNTP-Posting-Host: | eduserv1.rug.ac.be |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Weiqi Gao wrote: > Short answer: > short c; > char hi, lo; > hi = c/256; > lo = c % 256; These are signed divisions. You should not use signed types for variables unless there is reason to. > Shorter answer: > fprintf(fh, "%d", c); > will save your 16-bit number as two ASCII chars. This is incorrect. -- \ Vik /-_-_-_-_-_-_/ \___/ Heyndrickx / \ /-_-_-_-_-_-_/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |