reading from the open socket then writing to a file...
more like appending. check this out. It doesn't work for me. I cant understand why.
When it is run, it asks for your message... but then it doesn't append it. Any ideas?
void postmessage (int sock)
int a = 0;
write(sock, "Message?\n", 10);
n = read(sock,buffer,255);
if (n < 0) error("ERROR reading from socket");
if ((outputfile = fopen("messages.txt", "w")) == NULL)
fprintf(stderr, "Cannot open %s\n", outputfile);
a = 0;
while(ch = buffer[a] != '|', a< 255)
n = putc(ch, outputfile);
if (n < 0) error("ERROR writing to file");
a = a + 1;