L
Lars Langer
Hi there,
I'm new to this C - never the less - I'm trying to search a string for the
occurence of a substring - However, I'm not very succesful since my use of
the strstr function always returns NULL. But I know that there exsists such
a substring, as I can see it with my own two eye when I print out the string
to be searched. I added the code of the function (resolveResponse)and how I
call this code -
Calling the function:
----
resolveResponse(buffer);
----
buffer is defined this way;
----
char buffer[8192];
----
The Function called
----
char *resolveResponse(char *buffer) {
char *endOfResponse; char *startOfFile;
printf(buffer);
endOfResponse = strstr(buffer, "****"); /* <--- Always NULL */
if(endOfResponse == NULL) {
printf("\nEnd not found!\n");
}
startOfFile = endOfResponse+4;
return startOfFile;
}
Your help is much appreciated!
Best regards Lars
I'm new to this C - never the less - I'm trying to search a string for the
occurence of a substring - However, I'm not very succesful since my use of
the strstr function always returns NULL. But I know that there exsists such
a substring, as I can see it with my own two eye when I print out the string
to be searched. I added the code of the function (resolveResponse)and how I
call this code -
Calling the function:
----
resolveResponse(buffer);
----
buffer is defined this way;
----
char buffer[8192];
----
The Function called
----
char *resolveResponse(char *buffer) {
char *endOfResponse; char *startOfFile;
printf(buffer);
endOfResponse = strstr(buffer, "****"); /* <--- Always NULL */
if(endOfResponse == NULL) {
printf("\nEnd not found!\n");
}
startOfFile = endOfResponse+4;
return startOfFile;
}
Your help is much appreciated!
Best regards Lars