Pelles C forum
C language => User contributions => Topic started by: sergey on June 06, 2010, 09:26:13 PM
-
Work with GPS via COM-port (RS-232 or USB) as result is Byte-array.
I need pure C-string from Byte-array to use functions from string library:
to find substring, to strcat(), to truncate, to strspy() ...
Here my console-project to debug ability convertion Array of bytes/chars to pure C-string.
Sergey.
-
Update of previous message and project.
String and Array in C-language. Their mutual conversion.
Possibly for skilled programmers this theme for a long time is solved.
But I have not found direct functions in standard libraries of C-language for such transformations.
On the Internet this question now also is not discussed. Possibly because in C++ for this purpose there are ready classes.
I work with binary report Garmin-navigators (to tell with a byte-stream more precisely) and transformation of a Array to a String, search sub-String in String and so forth is frequently event. At a byte-stream are present all Bytes from 0 up to 255.
And the byte 0 meets very often and should be in String received from a Byte-Array. And should be processed.
For more clear representation on the display I have replaced real Garmin-stream with the text with inclusion of symbols 0x10 and 0x03 are symbols-dividers of messages Garmin-navigators.
Here I also have written the console-program for representation of conversion Byte-Array <-> C-String.
Someone can-be it it is useful.
Excuse, but the most part of comments in the source C-text in Russian.
On the display the program print in English.
Sergey.