Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Parsing String's Help!?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Zerosignull   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 August 2001 - 04:54 AM

Has ne body got ne good ieas on how about going about the extrating of the "Origin" data from the following text? { "classname" "info_player_deathmatch" "angle" "273" "origin" "464 -32 -216" } ~prevail by daring to fail~

Sponsor:

#2 Anonymous Poster_Anonymous Poster_*   Guests   -  Reputation:

Likes

Posted 08 August 2001 - 05:15 AM

char* originpos;
// set originpos to first letter in the word origin
originpos = strstr( text, "\"origin\"");
// move originpos up to the first number
originpos += strlen( "\"origin\" \"");
int part1, part2, part3;
// convert string to number
part1 = atoi( originpos);
// move to next space
originpos = strstr( originpos, " ");
originpos += strlen( " ");
part2 = atoi( originpos);
// move to next space
originpos = strstr( originpos, " ");
originpos += strlen( " ");
part3 = atoi( originpos);


#3 Zerosignull   Members   -  Reputation: 122

Like
Likes
Like

Posted 08 August 2001 - 06:32 AM

Casn u point me to some tutorials so i can beter under stand what some of those funstions do like

strstr();
atoi();

~prevail by daring to fail~

#4 BeerNutts   Crossbones+   -  Reputation: 2985

Like
Likes
Like

Posted 08 August 2001 - 06:44 AM

strstr() and atoi() are in the standard C libraries. Look in any reference book. I suggest buying "The C Programming Language" by Kernighan and Ritchie, the guys who basically wrote the C language. It''s a great reference book.

Nutts




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS