microblaze getchar() not functioning properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux