Hallo zusammen,
ich habe eine Frage zu Pointer (stehe mit denen echt auf Kriegsfuss ;-(
). Ist zwar ein Fujitsu 16fx / 96340 Projekt mit Softune, denke aber,
dass es sich eher um eine grundsätzliche Frage handelt.
Also - in meinem Hauptprogramm ist folgendes drin:
1 | char webIfParsed[64];
|
2 | ...
|
3 | *webIfParsed = 0;
|
4 | parse_command(webIfGotData, webIfParsed);
|
5 | if (strcmp(webIfParsed, "getstatus") == 0) // status requested
|
6 | {
|
7 | ....
|
8 | }
|
Klappt soweit wunderbar, der Vergleich funktioniert und die If-Bedingung
wird auch wie gewünscht ausgeführt.
Nun zum Problem - ich möchte gerne innerhalb von parse_command bereits
einen Vergleich auf den Wert machen:
1 | void parse_command(const char *input, char* command)
|
2 | {
|
3 | // Achtung, hier nicht webIfParsed, sondern command
|
4 | /* copy first token to command */
|
5 | while (( *input != 0) && (*input != ' ') && (*input != 10))
|
6 | {
|
7 | *command = *input;
|
8 | command++;
|
9 | input++;
|
10 | }
|
11 | *command = 0;
|
12 |
|
13 | // HIER DER VERGLEICH
|
14 | if (strcmp(command, "getstatus") == 0)
|
15 | {
|
16 | ....
|
17 | }
|
18 | ....
|
19 | }
|
Dieser Vergleich klappt nicht ?! Ich stehe echt auf dem Schlauch, kann
mir jemand helfen?
Danke,
Sebastian