I have client.c and server.c programs. The client should send the characters from a to z and the server convert them in uppercase.
When I compile client.c I get this warnings:
client.c: In function ‘main’:
client.c:21:15: warning: passing argument 2 of ‘strcpy’ makes pointer from integer without a cast [-Wint-conversion]
In file included from client.c:4:0:
/usr/include/string.h:121:14: note: expected ‘const char * restrict’ but argument is of type ‘char’
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
Yes. Don't use strcpy like that. What you are actually telling the compiler is that you want to copy strings from memory locations 65, then 66, then 67, ...
Because strcpy works with pointers, not with character values. So the manifest constant 'a' gets translated into an integer equivalent to its ASCII code value (65), and strcpy attempts to copy characters starting at memory location 65. Which is generally hardware-protected low memory.
That's not a problem with shared memory or with client/server. You have failed at a basic C function. And C isn't very forgiving of failure.
When it comes to destroying a civilization, gas chambers cannot hold a candle to echo chambers.
What's wrong? Where are you going? Stop! Read this tiny ad:
how do I do my own kindle-like thing - without amazon