So you mean something like this does not compile without an error/warning?

#include <stdio.h>
#include <string.h>

int main(void) {
    char mystring[] = "this is a test.\n";
    char *p = strchr(mystring, '\n');
    if (p != NULL) *p = '\0';
    printf("%s no newlines should occur.\n", mystring);

If so, maybe you should check your compiler/warning settings. That is standard code and compiles fine for me under gcc.


This is the warning:

"wordlink_options.c", line 75.7: 1506-068 (W) Operation between types "unsigned char*" and "int" is not allowed.

and the code is:

char *p;

Did you #include <string.h> ?

Really, you could avoid 20 questions by posting a minimal snippet of actual code, such as joeprogrammer has done, and get an answer much quicker.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.