Open In App

outtext() function in C

Last Updated : 06 Dec, 2019
Improve
Improve
Like Article
Like
Save
Share
Report

The header file graphics.h contains outtext() function which displays text at current position.

Syntax :

void outtext(char *string);

Examples :

Input : string = "Hello Geek, Have a good day !"
Output : 

Input : string = "GeeksforGeeks is the best !"
Output :  

Note : Do not use text mode functions like printf while working in graphics mode. Ensure that the text doesn’t go beyond the screen while using outtext.

Below is the implementation for outtext() function:




// C Implementation for outtext()
#include <graphics.h>
  
// driver code
int main()
{
    // gm is Graphics mode which is
    // a computer display mode that
    // generates image using pixels.
    // DETECT is a macro defined in
    // "graphics.h" header file
    int gd = DETECT, gm;
  
    // initgraph initializes the
    // graphics system by loading a
    // graphics driver from disk
    initgraph(&gd, &gm, "");
  
    // outtext function
    outtext("Hello Geek, Have a good day !");
  
    getch();
  
    // closegraph function closes the
    // graphics mode and deallocates
    // all memory allocated by
    // graphics system .
    closegraph();
  
    return 0;
}


Output :



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads