Open topic with navigation
|Example: TE_get_line_attribute||Text Retrieval Functions|
Returns information about text formatting.
char *TE_get_line_attribute( int col, int row, int width, char *buf );
|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.|
|buf||A buffer containing the format of each character in the line that is read from the screen. The function identifies the following formats: bold, underline, normal, blink, or reverse. Be careful to allocate a large enough buffer to accommodate the line.|
Note that for any of the output parameters, you can specify NULL if you do not need the value.
TE_get_line_attribute checks the format of a single line of text in the terminal screen. 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. The function stores the character formats for each character in the buffer buf.
You can use the following macros to determine whether a given character contains the specified formatting: IS_BOLD, IS_UNDERLINE, IS_NORMAL, IS_REVERSE, IS_BLINK. Note that this function does not return the formatting of the entire string, but rather of each character according to its index in the buffer. A character may have more than one format attribute.
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 format of the text in the fifth row of the screen, you can specify:
TE_get_line_attribute (1,5,-1, format);
Since the width parameter is set to -1, the function will read the format of any text in the fifth row.
This function returns a pointer to the buffer buf. Attributes are returned by a byte string, each reflecting a character's attribute. Use the macros described above to translate the strings. 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.