[plug] C help (only slightly Linux)

Leon Brooks leonb at ami.com.au
Tue Jul 14 06:37:37 WST 1998


Shackleton, Kevin wrote:
> I have a project to program an HP200LX to read GPS data files that look
> like this:
> $GPXTE,A,A,,,N*3C
> $GPBWC,051808,,,,,,T,,M,,N,*12
> $GPRMC,051809,A,2451.22,S,11343.69,E,001.6,284.7,030798,,*07
> $GPRMB,A,,,,,,,,,,,,V*71
> $GPR00,,,,,,,,,,,,,,*45
> $GPGLL,2451.22,S,11343.69,E*7F
> $PGRMZ,-499,f,2*33

> The main trouble I'm having is finding the best way to cut out the bits
> of data I want.  In Pascal I'd do a copy() (which is a mid$() in Basic).
> P2C helpfully converted copy() to strsub(), which does not exist in
> Borland C.

strncpy (dest_char_array, source_char_array + start_offset,
length_limit);

Beware that this doesn't add the trailing null ('\0') if the string is
overlength (but there's probably one that does). Try also "man strncpy"
and read the see-alsos.

> Is anyone interested in a Borland C co-development (ie you do it, I take
> the credit), or can someone recommend a C book that deals with string
> handling - the couple I've got practically ignore this area.

"less /usr/include/string.h" and ignore all of the extern keywords, __P
definitions etc.

Or post your problems here. (-:

0411-655-020


More information about the plug mailing list