Results 1 to 3 of 3

Thread: String/Char Array commands ...

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    50

    String/Char Array commands ...

    I need a quick refresher on some C commands that act on strings or char arrays ... what I have is a GPS unit connected to my machine, and I want to manipulate some of the raw NEMA data ... can anyone help me on what C commands to use for the following:

    Assuming that the data from the GPS comes as a char array (or a string, but i'm almost certain a char array), i want to create a data structure that parses the data ... the data is deliminated by field, i.e.:

    <location><direction><velocity>& lt;etc...>

    is what will be passed to me ... now, given that its a char array, how do i extract these specific values? Assume that the location field contains to floats, and that the direction and velocity are doubles.

    I know this C functions exist for this, I'm just not familiar with them, thanks!

  2. #2

    Re:String/Char Array commands ...

    can you give an example of the type of string this would be? is it space seperated?

    In C there are no strings, just char arrays or char *'s which are the equivilant to a string.

  3. #3

    Re:String/Char Array commands ...

    Code:
    int parseIndex,start,end,tempParse,indexCounter;
    for(parseIndex=0;parseIndex < MAX_PARSE_ARR || arr[parseIndex]!='\0';parseIndex++)
    {
      if(arr[parseIndex]=='.'&&arr[parseIndex+1]==':')
       { 
      start=parseIndex;
         for(tempParse=parseIndex+1;arr[tempParse]!='.'&&arr[tempParse+1]!=':';tempParse++)
    slut=tempParse;
    indexCounter++;
    getData(start,slut,indexCounter);
    }
    }
    something like that wrote it quick prolly some semantic faults.

    [edit:gorn]added code tags[/edit]

Similar Threads

  1. char pointer not work right
    By Blaqb0x in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 03-13-2003, 09:00 PM
  2. c string array question
    By t048 in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 07-12-2002, 03:02 PM
  3. int in char*
    By in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 04-12-2002, 07:24 AM
  4. I need help with char arrays in c
    By t048 in forum Linux - Software, Applications & Programming
    Replies: 6
    Last Post: 02-12-2002, 11:49 PM
  5. What is char-major-10-135?
    By Digital_Froggy in forum Linux - General Topics
    Replies: 2
    Last Post: 12-19-2001, 01:01 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •