1

In my C program, I am printing a string to the command terminal using printf("%d %s %s\n", node->id, node->date, node->input); but I need to now use the write function write(STDOUT_FILENO, cmdline, strlen(cmdline));...

How can I format the string like I did using printf?

4

1 に答える 1

10

Use sprintf/snprintf to format the string into a character buffer, and then write that.

于 2013-01-13T00:32:32.443 に答える