0

I create an SMTP server and i have to read from keyboard the subject and then send it, the client found whet the subject is only 1 word, but when are spaces doesnt send anything, anyone can help me?

printf("Insert the subject:\n");
scanf("%s",sub);
strcat(sub,"\r\n");


send_socket("Subject: ");
send_socket(sub);
alk
  • 69,737
  • 10
  • 105
  • 255
  • 4
    This is what the man page will tell you: `%s` format stops scanning at the first whitespace. I suggest using `fgets` and then the input will already be ended by a newline, you won't have to add one. – Weather Vane Jun 17 '18 at 12:29
  • Its true, now works perfectly ty! – Jose Manuel Jun 17 '18 at 12:40
  • I do not see how this question is related to anything around SMTP or even sockets at all. – alk Jun 17 '18 at 16:37

0 Answers0