Advertisement

C++ Question

Started by January 30, 2002 02:44 PM
2 comments, last by pigsfl3w 22 years, 7 months ago
Ok, I know what I want to do, just not how to do it. I want to take a char array, split it into different parts like this: 12-2-5-4 becomes a=12 b=2 c=5 d=4 or something like that. I just don''t know how to seperate a string into parts by seperating marks. I hope I''m phrasing this clear enough. If anyone knows how to do this, please reply. Thanks, pigsfl3w
From what I understand, this is what you're looking for.

Edited by - Supernova on January 30, 2002 3:55:32 PM
Advertisement
Yep, strtok() is what you want. If you intent to convert from string to integer values, you''ll also want to look at atoi().


---
John Hattan Sweet software for a saturnine world
john@thecodezone.com http://www.thecodezone.com

(my byline from the Gamedev Collection series, which I co-edited) John Hattan has been working steadily in the casual game-space since the TRS-80 days and professionally since 1990. After seeing his small-format games turned down for what turned out to be Tandy's last PC release, he took them independent, eventually releasing them as several discount game-packs through a couple of publishers. The packs are actually still available on store-shelves, although you'll need a keen eye to find them nowadays. He continues to work in the casual game-space as an independent developer, largely working on games in Flash for his website, The Code Zone (www.thecodezone.com). His current scheme is to distribute his games virally on various web-portals and widget platforms. In addition, John writes weekly product reviews and blogs (over ten years old) for www.gamedev.net from his home office where he lives with his wife and daughter in their home in the woods near Lake Grapevine in Texas.

Thank you very much, this is exactly what i needed!

This topic is closed to new replies.

Advertisement