GBDK 2020 Docs  4.3.0
API Documentation for GBDK 2020
stdio.h File Reference
#include <types.h>

Go to the source code of this file.

Functions

void putchar (char c) OLDCALL REENTRANT
 
void printf (const char *format,...)
 
void sprintf (char *str, const char *format,...)
 
void puts (const char *s)
 
char * gets (char *s) OLDCALL
 
char getchar (void) OLDCALL
 

Detailed Description

Basic file/console input output functions.

Including stdio.h will use a large number of the background tiles for font characters. If stdio.h is not included then that space will be available for use with other tiles instead.

Function Documentation

◆ putchar()

void putchar ( char  c)

Print char to stdout.

Parameters
cCharacter to print

◆ printf()

void printf ( const char *  format,
  ... 
)

Print the string and arguments given by format to stdout.

Parameters
formatThe format string as per printf

Does not return the number of characters printed.

Currently supported:

  • %hx (char as hex)
  • %hu (unsigned char)
  • %hd (signed char)
  • %c (character)
  • %u (unsigned int)
  • %d (signed int)
  • %x (unsigned int as hex)
  • %s (string)

Warning: to correctly pass parameters (such as chars, ints, etc) all of them should always be explicitly cast as when calling the function. See docs_chars_varargs for more details.

◆ sprintf()

void sprintf ( char *  str,
const char *  format,
  ... 
)

Print the string and arguments given by format to a buffer.

Parameters
strThe buffer to print into
formatThe format string as per printf

Does not return the number of characters printed.

Warning: to correctly pass parameters (such as chars, ints, etc) all of them should always be explicitly cast as when calling the function. See docs_chars_varargs for more details.

◆ puts()

void puts ( const char *  s)

puts() writes the string s and a trailing newline to stdout.

◆ gets()

char* gets ( char *  s)

gets() Reads a line from stdin into a buffer pointed to by s.

Parameters
sBuffer to store string in

Reads until either a terminating newline or an EOF, which it replaces with '\0'. No check for buffer overrun is performed.

Returns: Buffer pointed to by s

◆ getchar()

char getchar ( void  )

getchar() Reads and returns a single character from stdin.