This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

sscanf problem

i am reciving the gps packet for serial port and written code like as below.
rxbuf[100]="081417.138,A,1728.6091,N,07833.8230,E,0.00,49.52,280306,,,A*5E";
main()
{
sscanf(&RxBuf[0],"%lf,%c,%lf,%c,%lf,%c,%lf,%lf,%lf",&time,&valid,&latnow,&latnowdir,&lonnow,&lonnowdir,&speed,&course,&date);
if(valid=='A')
{
here write my code;

}
}
this program will give correct outpu in debugging but it can not work practically.
slove this problem any body knows about this.

  • You must learn more about the '51 before you continue. It makes no sense whatsoever to use a "%lf" scanf format specifier in C51 --- this compiler doesn't have doubles. You're also likely to be blowing the argument length limit of the function. Please consult the manual for C51's implementation of sscanf before going on.