strcpy(s,lookup(line)); After gdb: Program received signal SIGSEGV, Segmentation fault. __strcpy_ssse3 () at ../sysdeps/i386/i686/multiarch/strcpy-ssse3.S:84 I would look for another way, for example: // copy line to new string char* temp = malloc(strlen(line) + 1); if(temp == NULL) { free(temp); return false; } strcpy(temp, line); i don't know how is possible to resolve server without using gdb, this is a fundamental skill that you have to learn. I also do not know what you intend to use lookup, if only returns a string with the MIME type of file, you have to analyze line and see that it fulfills the specifications