Mail Archives: djgpp/1997/02/23/23:30:54
On Sun, 23 Feb 1997, Neil Roy wrote:
> 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.
I recommend that you mask out the near/far/huge modifiers by #defining
them as nothing, i.e.,
#define far
What I've found is that when I remove these items, I almost inevitably
want them back at some point in the future.
> 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?
printf() is buffered and the buffer isn't flushed until it sees a \n. Try
putting a call to fflush (stdout); between the call to printf and scanf.
> Any help is appreaciated and remember, you were a "newby" at one time
> or another too! ;-)
Actually, newbies are treated better on this news list than most I've
seen. It's a refreshing change :-).
>
> Thanx in advance;
> Neil Roy
> Email: royn AT usa DOT net
>
David May
ID Card Adminstrator
Albuquerque TVI
- Raw text -