Hi i am writing a simple c program to test parsing a buffer in c but when i run the program i get the following errors:
./test.c: line 4: syntax error near unexpected token `('
./test.c: line 4: `int main()'
Does anyone know why these errors are occurring? Thanks
#include <stdio.h>
#include <stdlib.h>
int main()
{
char* command;
char* buf = malloc(100 *sizeof(char));
buf = "GET /index.html HTTP/1.1\n Host: www.gla.ac.uk\n";
command = strtok(buf, " ");
printf("%s", command );
free(buf);
}