Question on serial port and data buffer
-
I have a GPS program serially reading incoming data. A sample of my code is below. // get speed Code = mgcGetData(GPRMC_SPEED,(LPSTR)DataBuffer); if(Code<0) ShowMGC32Error(Code); if(Code>0) printf("%5s ", DataBuffer); I have the program printing a few of these data buffers to the screen. I was wondering how to store this data file readout into a actual variable so i can do some calculations i cant just do variable=databuffer; ???
-
I have a GPS program serially reading incoming data. A sample of my code is below. // get speed Code = mgcGetData(GPRMC_SPEED,(LPSTR)DataBuffer); if(Code<0) ShowMGC32Error(Code); if(Code>0) printf("%5s ", DataBuffer); I have the program printing a few of these data buffers to the screen. I was wondering how to store this data file readout into a actual variable so i can do some calculations i cant just do variable=databuffer; ???
-
TCHAR szData[16]; wsprintf(szData,_T("%5s"),DataBuffer); or use sprintf,(CRT Library) I am seeking... For what? Why did you ask me for what? I don't know!
i get these errors C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4013: '_T' undefined; assuming extern returning int C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int ' C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4024: 'wsprintfA' : different types for formal and actual parameter 2
-
I have a GPS program serially reading incoming data. A sample of my code is below. // get speed Code = mgcGetData(GPRMC_SPEED,(LPSTR)DataBuffer); if(Code<0) ShowMGC32Error(Code); if(Code>0) printf("%5s ", DataBuffer); I have the program printing a few of these data buffers to the screen. I was wondering how to store this data file readout into a actual variable so i can do some calculations i cant just do variable=databuffer; ???
I assume you want to convert a string of some form into a number of some form. So look at 'atoi' as a first pass, then 'strtoul' and it's relatives, possibly 'scanf'. Paul
-
i get these errors C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4013: '_T' undefined; assuming extern returning int C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int ' C:\Program Files\Microsoft Visual Studio\VC98\MGC4C\apps\gprmc.c(125) : warning C4024: 'wsprintfA' : different types for formal and actual parameter 2