delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/06/18:21:10

From: ab837 AT sfn DOT saskatoon DOT sk DOT ca (James Edwin Cooper)
Newsgroups: comp.os.msdos.djgpp
Subject: Why won't it change?!?
Date: 6 Jul 1997 11:06:49 GMT
Organization: Saskatoon Free-Net
Lines: 33
Message-ID: <5pnu89$6tr$1@missing.link.ca>
NNTP-Posting-Host: broadway.sfn.saskatoon.sk.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Here is a sample program I made:
main()
{
char letter;
printf("please type a letter: ");
getche(letter);
printf("\nYour letter was "%c, letter);
}

I think that is what it is, probably a couple mistakes.
Anyway, I fixed the code,etc. and got it to compile and work but only the 
first time I use it does it work right. Here is an example:

PASS 1: please type a letter: e
Your letter was e
PASS 2: please type a letter: s
Your letter was e
PASS 3: please type a letter: b
Your letter was e

Any reason WHY? Same thing happens with random number generators. Also, I 
tried a timing exercise and here is what happened:
PASS 1: Time:4.57676736(whatever) seconds.
PASS 2: Time:4.57676736 seconds.

Another time:
PASS 1: Time:2.54 (???) seconds.
PASS 2: Time:0 seconds.

If you can explain ANY of these odd occurances It would be appreciated. 
P.S. I got these STRAIGHT from a book (with minor changes for DJGPP) so 
their is NO mistakes in what I compiled! Just weird output on the second 
run. First run is correct but the next ones don't work properly! Thanks!

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019