Click here to Skip to main content
15,917,652 members

Comments by Member 8526422 (Top 1 by date)

Member 8526422 20-Aug-12 19:39pm View    
Thank for Ponting out the fopen mistake, had not seen that at all, now corrected (r+). I have changed the code to look for the return value of fgets and tried some debugging but still can not read the comport. The return value of fgets is still always zero, his is where to program hangs. I have tried replacing the read comport to read from stdin (you can see a previous while condition commented out) and this works.

code modification below

while (true) //(fgets(buff, sizeof buff, stdin)== NULL);
{
if(fgets(buff, sizeof buff, comport)!= NULL);
{
//strcpy(rstr, buff );
printf("%s\n",buff);
break;
}
}