05-26-2023, 08:44 PM
(This post was last modified: 05-26-2023, 08:45 PM by Kernelpanic.)
I tried to write a program in C that corresponds to the StringTokenizer in Java, and then call it from QB64, but it does not work.
There are no problems when compiling, but the program crashes when run.
I've tried everything I can think of for over two hours, and according to the manuals, I don't know why the program crashes.
The developers of QB64 know C/C++ - why does the program crash? Where is the mistake?
There are no problems when compiling, but the program crashes when run.
I've tried everything I can think of for over two hours, and according to the manuals, I don't know why the program crashes.
The developers of QB64 know C/C++ - why does the program crash? Where is the mistake?
Code: (Select All)
//Beispiel für StringTokenizer aus Java in C
//Schildt, S.338 - 26. Mai 2023
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char *text;
text = strtok("They came never back!", " ");
printf(text);
printf("\n\n");
do
{
text = strtok('\0', " ");
if (text)
{
printf("\n%s", text);
}
}while(text);
return(0);
}