| www.delorie.com/archives/browse.cgi | search |
| From: | Endlisnis <s257m AT unb DOT ca> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | Re: Detecting interrupt on printer port |
| Date: | Tue, 11 Aug 1998 19:02:25 -0300 |
| Organization: | NBTel Internet |
| Lines: | 21 |
| Message-ID: | <35D0BF71.9FB3EE0B@unb.ca> |
| References: | <C22A1.62$Qi3 DOT 325552 AT sapphire DOT mtt DOT net> |
| NNTP-Posting-Host: | fctnts06c82.nbnet.nb.ca |
| Mime-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
Michel Gallant wrote:
> //global counter
> int counter = 0;
use:
volatile int counter = 0;
You need to do this because DJGPP will likely move counter into a register
during the loop where you print the value in printf. Setting a variable to
'volatile' forces DJGPP to reload 'counter' from memory every time it is
used.
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlis AT nbnet DOT nb DOT ca
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |