What is the usage of the text function in C language?

In the C language, the text function is used to append a specified string to the output stream. Its prototype is:

int text(const char *str);

The parameter str is a pointer to the string to be output. The text function appends this string to the current standard output stream and returns a non-negative value to indicate success. If an error occurs, EOF is returned.

Here is a simple example:

#include <stdio.h>

int main() {
    text("Hello, World!\n");
    
    return 0;
}

Executing the program will output the string “Hello, World!” to the standard output stream.

Leave a Reply 0

Your email address will not be published. Required fields are marked *