No Subject
Tan Pinghui
tanph@bj.col.com.cn
Mon Apr 27 20:39:00 GMT 1998
Hello,
I compiled the tool chain of binutils-2.7, gcc-2.7.2.1, newlib-1.8.0,
gdb-4.16 to do Linux to i386-coff cross-development, the tool building
process is successful. My host environment is a linux 2.0.30, target
machine is a 386 PC without OS support. The target use the RS-232 port
to input/output data.
Some strange behaviors occur with the following simple program, I
can't figure out why and how.
---------------------------------------------------
#include <stdio.h>
int main(void)
{
char name[100];
while (1) {
printf("Enter your name: ");
gets(name);
printf("Hello, %s!\n", name);
}
return 0;
}
---------------------------------------------------
The terminal screen snapshot is:
---------------------------------------------------
Enter your name: Hello, ABCD!
Enter your name: Hello, ABCD!
Enter your name: Hello, ABCD!
Enter your name: Hello, ABCD!
....
---------------------------------------------------
After printing the first "Enter your name: ", the program stoped to
wait for the input, that's right. I entered "ABCD<CR>".
What strange is:
(1) It didn't echo my input to the terminal
(2) It didn't go to the next printf statement but continued to
wait for the input
(3) I entered a second <CR>, it didn't go but fly. The program
kept printing "Enter your name: Hello, ABCD!" and didn't stop
to wait for further input.
I've tried newlib-1.7.0 also, but the result is same. The crt0 and
libgloss routines are correct I think, what's the matter?
Best regards,
Tan Pinghui mailto:tanph@bj.col.com.cn
More information about the crossgcc
mailing list