GBDK 2020 Docs API Documentation for GBDK 2020

Functions
stdio.h File Reference
`#include <types.h>`

Go to the source code of this file.

## Functions
void | putchar (char c)
void | printf (const char *format,...) NONBANKED
void | sprintf (char *str, const char *format,...) NONBANKED
void | puts (const char *s) NONBANKED
char * | gets (char *s)
char | getchar (void)

## 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 | ) |

Write the character c to stdout.

## ◆ printf()

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

Print the string and arguments given by format to stdout.

Parameters

  format | The 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 chars for printing as chars, they must be explicitly re-cast as such 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

  str | The buffer to print into
  format | The format string as per printf

Does not return the number of characters printed.

## ◆ 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

  s | Buffer 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.