CNDP  22.08.0
cne_stdio.h File Reference
#include <termios.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <cne_atomic.h>
#include <cne_common.h>
#include <cne_system.h>
#include <vt100_out.h>

Go to the source code of this file.

Functions

CNDP_API int cne_printf (const char *fmt,...)
 
CNDP_API int cne_printf_pos (int16_t r, int16_t c, const char *fmt,...)
 
CNDP_API int cne_fprintf (FILE *f, const char *fmt,...)
 
CNDP_API int cne_snprintf (char *buff, int len, const char *fmt,...)
 
CNDP_API int cne_cprintf (int16_t r, int16_t ncols, const char *fmt,...)
 
CNDP_API int cne_vsnprintf (char *buff, int len, const char *fmt, va_list ap)
 
CNDP_API int cne_vprintf (const char *fmt, va_list ap)
 

Detailed Description

CNE cursor and color support for VT100 using ANSI color escape codes.

Definition in file cne_stdio.h.

Function Documentation

◆ cne_printf()

◆ cne_printf_pos()

CNDP_API int cne_printf_pos ( int16_t  r,
int16_t  c,
const char *  fmt,
  ... 
)

cursor position the text at the given location for r and c.

Parameters
rThe row to place the text.
cThe column to place the text.
fmtThe cne_printf() like format string.
Examples
examples/cli/main.c, examples/cndpfwd/main.c, examples/cnet-graph/cnet-graph.c, examples/cnet-quic/cnet-quic.c, examples/dlb_test/dlb_test.c, examples/ibroker/main.c, examples/l3fwd-graph/fwd.c, examples/phil/main.c, and examples/timer/main.c.

◆ cne_fprintf()

CNDP_API int cne_fprintf ( FILE *  f,
const char *  fmt,
  ... 
)

Routine similar to fprintf() to output text to a file descriptor.

Parameters
fThe file descriptor to output the text to.
fmtThe format string to output.
Returns
The number of bytes written

◆ cne_snprintf()

CNDP_API int cne_snprintf ( char *  buff,
int  len,
const char *  fmt,
  ... 
)

Format a string with color formatting and return the number of bytes

Parameters
buffThe buffer to place the formatted string with color
lenThe max length of the buff array
fmtThe formatting string to use with any arguments
Returns
The number of bytes written into the buff array

◆ cne_cprintf()

CNDP_API int cne_cprintf ( int16_t  r,
int16_t  ncols,
const char *  fmt,
  ... 
)

Output a string at a given row/column using printf like formatting. Centering the text on the console display, using the ncols value

Parameters
rThe row to start the print out of the string.
ncolsNumber of columns on the line. Used to center the text on the line.
fmtThe formatting string to use to print the text data.

◆ cne_vsnprintf()

CNDP_API int cne_vsnprintf ( char *  buff,
int  len,
const char *  fmt,
va_list  ap 
)

vsnprintf() like function using va_list pointer with color tags.

Parameters
buffThe output buffer to place the text
lenThe length of the buff array
fmtThe format string with color tags
apThe va_list pointer to be used byt vsnprintf()
Returns
The number of bytes in the buff array or -1 on error

◆ cne_vprintf()

CNDP_API int cne_vprintf ( const char *  fmt,
va_list  ap 
)

vprintf() like function using va_list pointer with color tags.

Parameters
fmtThe format string with color tags
apThe va_list pointer to be used
Returns
number of bytes written to output or -1 on error