Example: TE_get_text_lineText Retrieval Functions

Reads the text from the designated line in the terminal emulator screen.

char *TE_get_text_line( int col, int row, int width, char *text );


col, row The column and row coordinates of the first character in the line to be read.
width The width of the text line to be read. If the width is less than 1, then the end of the line is assumed.


text The string that was read from the screen. The string is null-terminated. Be careful to allocate a large enough buffer to accommodate the text.

Note that for any output parameter, you can specify NULL if you do not need the value.

TE_get_text_line copies a line of text from the terminal screen to a buffer text. The first character in the line is defined by col, row. The column coordinate of the last character in the line is indicated by width. If the line contains tabs or spaces, the equivalent number of spaces is returned.

The terminal emulator screen is measured in characters. The character with position 1,1 is in the top left corner of the screen. If you set the width to less than 1, then the end of the line is assumed. For example, in order indicate that the function should read the text in the fifth row of the screen, you can specify

TE_get_text_line(1,5,-1, text);

Since the width parameter is set to -1, the function will read all text in the fifth row.

Return Values

This function returns a pointer to the buffer text. If the function fails, it returns null and sets TE_errno to an error code.


You cannot use standard parameterization for any arguments in this function.