difference between fputs and puts in c
Asked Answered
O

1

5

please explain it to me that what is the dfference between puts(string name) and fputs(string name,stdout)

both of them have the same output especially when I use fgets(string name,n,stdin) for get std size of a string for a safe code , but after that and for print to output , what is the difference between them although both of them have the same output?

Onitaonlooker answered 27/8, 2021 at 15:47 Comment(3)
puts is equivalent to fputs("",stdin), but with a newline character after the string.Malacology
You might want to read more about these functions in your books. Or a decent fputs and puts reference.Brunhilde
@Malacology I think you meant fputs("",stdout) because you cannot write to stdinEulogistic
J
8

puts appends a newline to the string, and fputs doesn't.

Otherwise there is no difference, except of course that with fputs you can specify a different stream, while puts always writes to stdout.

Jaquelin answered 27/8, 2021 at 15:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.