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. Windows 2000 Hardware Compatibility List
    By regix in forum Windows - General Topics
    Replies: 11
    Last Post: 01-04-2005, 08:20 AM
  2. Macro Recorder Does Not Record Window Commands
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-04-2005, 02:08 AM
  3. Putting more commands behind an already running command
    By Uranus in forum Linux - General Topics
    Replies: 4
    Last Post: 11-22-2004, 09:52 AM
  4. c string array question
    By t048 in forum Linux - Software, Applications & Programming
    Replies: 5
    Last Post: 07-12-2002, 03:02 PM
  5. commands an redirectrion
    By navyret in forum Redhat / Fedora
    Replies: 3
    Last Post: 11-05-2001, 01:11 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
  •