From: peuha AT cc DOT helsinki DOT fi (Esa A E Peuha) Newsgroups: comp.os.msdos.djgpp Subject: Re: Converting MIcrosoft/Borland C to GNU C Date: 28 Feb 1997 11:08:07 GMT Organization: University of Helsinki Lines: 39 Message-ID: <5f6ean$act@oravannahka.Helsinki.FI> References: <33109AEA DOT 6AD3 AT usa DOT net> Reply-To: Esa DOT Peuha AT helsinki DOT fi NNTP-Posting-Host: kruuna-ether.helsinki.fi Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Neil Roy (royn AT usa DOT net) wrote: : I am a beginner C programmer, I used to program in BASIC (QuickBasic : and others) and have read "Moving from QBasic to C" (great book!) and : will be reading a C++ book and then will be moving on to a rather : lengthy book on game programming, the problem is, while the C and C++ : books properly teach you using ANSI C examples, the game programming : book uses Microsoft C (7.0) examples and I was wondering if anyone out : there had any tips/sugestions etc... on how I should go about converting : the source code over. I know about "far", "near" etc... (or think I do, : if you have any insights into that part of programming please let me : know!) but after removing the "far" from the source, more often than : not, the program simply will not execute properly (if at all). I : usually get tons of compiler errors. It's not that simple. You may have to rewrite parts of your code in order to make it work. A small example of a typical case would be helpful in helping you. : Another problem I noticed with GNU/DJGPP is that after I compile and : example program, say: : printf("Enter your age:"); : scanf(" %d", &age); : ...the prompt "Enter your age:" doesn't appear until the age is : entered. I realize that scanf() is probably the worst way to get input, : but just for examples and testing it should still print the printf() : before the scanf(). Have I missed something here or is there a bug I : have stumbled upon? A fflush(stdout); after printf(...); should help. This is because stdout is buffered so, without fflush, your prompt is printed only after you press return at the end of input. If your C book doesn't say anything about this, it's hardly worth reading ;-). -- Esa Peuha student of mathematics at the University of Helsinki http://www.helsinki.fi/~peuha/