This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
microblaze getchar() not functioning properly
- From: naga raj <gnuuser dot raj at gmail dot com>
- To: Michael Eager <eager at eagercon dot com>, gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Wed, 27 Jul 2011 16:05:47 +0530
- Subject: microblaze getchar() not functioning properly
Hi,
getchar function is not working properly. An extra null character is
appended for each and every input character.
Ex:
#include<stdio.h>
int main()
{
int i,j=0;
char buf[10];
xil_printf("main\n");
while(j<6)
{
i=getchar();
buf[j]=i;
}
xil_printf("%s\n",buf);
return 0;
}
For the above program if i give input as:
stefen
Then it is printing on 's'
I tried to print variable 'j' after getchar() function in code. Then
for each character I enter 'j' value is incremented by two.
Thanks,
Nagaraju