![]() |
Hallo und herzlich Willkommen aus den Vereinigten Staaten, die UNIX-und Linux-Foren! Vielen Dank für Ihren Besuch und die Teilnahme an unserem Global Community.
|
|
Google unix.com
|
|||||||
| Foren | Registrieren | Forum-Regeln | Links | Alben | FAQ | Benutzerliste | Kalender | Suche | Die heutige Beiträge | Alle Foren als gelesen markieren |
| High-Level-Programmierung Post Fragen zu C, C + +, Java, SQL, und andere Programmiersprachen hier. |
Mehr UNIX-und Linux-Forum Themen Vielleicht finden Sie hilfreiche
|
||||
| Faden | Thread Starter | Forum | Antworten | Last Post |
| Ein Programm, um die Ausführung eines anderen Programms | jiten_hegde | High-Level-Programmierung | 3 | 08-19-2008 06:26 AM |
| strtok gleichwertig in perl | jisha | Shell Programmierung und Scripting | 1 | 05-06-2008 04:38 AM |
| Regardign strtok ()-Ausgang Richtung 2-D-String-Array | SankarV | High-Level-Programmierung | 3 | 04-28-2008 10:48 AM |
| Strtok Funktion .... | Tanvirk | Linux | 3 | 01-24-2008 10:16 AM |
| besseren Weg als strtok? | annie | High-Level-Programmierung | 7 | 10-05-2005 03:01 PM |
|
|
LinkBack | Thread Tools | Suche diesen Thread | Rate Thread | Anzeige-Modi |
|
||||
|
So nutzen Sie strtok zweimal das gleiche Programm?
Code:
string str1(" 1 2 3 4 512543 ");
string str2;
if(str2.empty())
str2=str1;
cout << "str2:" <<str2 <<endl;
p1=strtok((char *)str1.c_str()," ");
while(p1)
{
v1.push_back(atoi(p1));
cout << "val of p1 " << p1 << endl;
p1=strtok(NULL," ");
}
cout << "size of v1 " << v1.size() <<endl;
p2=strtok((char *)str2.c_str()," ");
cout << "str2:" <<str2 <<endl;
while(p2)
{
v2.push_back(atoi(p2));
cout << "val of p2 " << p2 <<endl;
p2=strtok(NULL," ");
}
cout << "size of v2" << v2.size() <<endl;
Code:
str2: 1 2 3 4 512543 val of p1 1 val of p1 2 val of p1 3 val of p1 4 val of p1 512543 size of v1 5 str2: 1234512543 val of p2 1 after tok p2 size of v21 Wie kann ich tokenize str2 jetzt? Danke |
| Lesezeichen |
| Thread Tools | Suche diesen Thread |
| Anzeige-Modi | Rate this thread |
|
|