+ 2
How to use the write function
#include <stdio.h> #include <unistd.h> int main(void) { char name[] = "Cobby Sefah Solomon"; /* 0 = stdin, 1 = stdout, 2 = sterr */ /* name = to indicate the name var */ /* 11 = the number of characters we want to print */ write(1, name, 11); return 0; } See write man to read more.
6 Réponses
+ 5
Write In C takes three parameters.
1st - where to write to. STDIN/ STDOUT or even a file.
2nd - What to write. Might be stored in a variable or file.
3rd - Number of characters to write.
+ 4
Hunter X Cobby the Q&A forum is reserved for specific programming questions or questions about Sololearn. If you have a question about the write statement, please state it clearly. Otherwise, please understand that such information as this should be posted in your profile feed post.
+ 3
Leeroy Mokua perhaps I misinterpreted the post. It appears to me as an explanation of how to use the write function. There is an example of how to call it and then the OP directs where to find more information. Somehow the question is not apparent to me, sorry if I missed the mark!
+ 2
Brian He is asking a programming question.
+ 2
Brian and Leeroy Mokua you are both right. At first glance the way the question is asked could lead someone to assume that they are only providing an answer. Perhaps if they were to ask, "How does the write function work?" then it would cause less confusion.
+ 1
Looks like I hit it on the mark. This Profile feed post clarifies the intent.
https://www.sololearn.com/post/1739960/?ref=app