0

I'm developing a client/server multithread program in C. I need to send a message from client to server with a scanf but when in the client puts a space the scanf see it as a newline. How can I read an input message with scanf including spaces? (and so the scanf don't see it as a newline?)

Thank you and I'm sorry for my English!

atapi19
  • 227
  • 1
  • 3
  • 14

1 Answers1

0

Use fgets() to get your input into a string and sscanf() to evaluate it. Since you just want what the user entered, you don't really need sscanf() in this case anyway

See this post

Community
  • 1
  • 1
ZeenaZeek
  • 271
  • 3
  • 5
  • 16