clearerr clrscr fclose feof ferror fflush fgetc fgetchar fgetpos fgets fopen fprintf fputc fputchar fputs fread freopen fseek fsetpos ftell fwrite getc getchar gets printf printf_xy putc putchar puts remove rename rewind sprintf strerror strputchar ungetc unlink vcbprintf vfprintf vprintf vsprintfand the following constants and predefined types:
EOF FILE FileFlags fpos_t NULL SeekModes size_t va_listNOTE: This implementation of stdio.h is 90% compatible with ANSI standard. I tried to make all functions to be as close to ANSI as possible, without introducing too big overload of the generated code. The main differences are in the fact that sscanf function (and functions derived from it) is not yet implemented (if anybody knows a good and compact implementation for it, please mail to me), and there is no terminal-associated file streams like stdin and stdout which may be redirected (by the way, I don't see big needness for them). However, functions from this header file are mostly not TIOS functions - they are completely written by me, so they are not embedded in the TIOS. That's why usage of them may cause that your program will be larger than if you don't use functions from this header file (typical increase of the size is 300-2000 bytes, depending of which functions and how many different functions from this header file are used in the program). Also, this header file is not so good for "distributed" programs (e.g. programs which are spreaded in more modules which are linked separately). If your program is spreaded in more than one object file, avoid usage of the same function in more than one module (else it will be doubled in the final code). So, although functions from this header file are much more "standard" than TIOS-specific functions, it is better to avoid functions like fopen etc, especially in "multi-module" programs. Instead, use "non-standard" functions from vat.h header file. Of course, functions from this header file may be very useful for porting program from a "standard" computer to the TI. But, I will repeat again: it is better to avoid them.
Flags | Meaning |
none | Right align (pad spaces or zeros to left) |
- | Left align (pad spaces to right) |
+ | Always force sign (include prefix '+' before positive values) |
z | Don't postfix padding (this option is non-ANSI, e.g. TI specific) |
space | Insert space before positive values |
# | (prefix hex values (>0) with '0x') [does not appear to work] force '.' in float output (and prevent trunctation of trailing zeros) |
^ | TI-Float format: special character for the exponent, no '+' prefix in the exponent, 0. instead of 0 (this option is non-ANSI, e.g. TI specific) |
| | Centre the output in the field (this option is non-ANSI, e.g. TI specific) |
Width | Meaning |
num | Print at least num characters - padded the rest with blanks |
0num | (Zero prefixed) Same as above but padded with '0' |
* | The width is specified in the arguments list (before value being formatted) |
Precision | Meaning |
none | Default precision |
num | num is number of chars, decimal places, or number of significant digits (num<=16) to display depending on type (see below) |
-1 | Default = 6 digits (this option is non-ANSI, e.g. TI specific) |
* | The precision is specified in the argument list (before value being formatted) |
Size {h|l} | Meaning |
h | Force short integer |
l | Force long integer |
Type | Meaning |
d, i | Signed decimal integer |
u | Unsigned decimal integer |
x | Lowercase hexadecimal integer |
X | Uppercase hexadecimal integer |
e | Floating point, format [-]d.dddde[sign]ddd (exponential format) |
E | Like 'e' but with uppercase letter for the exponent |
f | floating point, format [-]dddd.dddd |
g | Floating point: most compact float format available ('e' or 'f'); this is the most common option, used for most dialog floats |
G | Like 'g' but with uppercase letter for the exponent |
r | Floating point, engineering form (this option is non-ANSI, e.g. TI specific) |
R | Like 'r' but with uppercase letter for the exponent |
y | Floating point, mode specified float format (this option is non-ANSI, e.g. TI specific) |
Y | Like 'y' but with uppercase letter for the exponent |
c | Character |
s | String |
p | Pointer; principally the same as 'x' |
% | None: the character '%' is printed instead |
Mode | Description |
r | Open for reading only. |
w | Create for writing. If a file by that name already exists, it will be overwritten. |
a | Append; open for writing at end of file, or create for writing if the file does not exist. |
r+ | Open an existing file for update (reading and writing). |
w+ | Create a new file for update (reading and writing). If a file by that name already exists, it will be overwritten. |
a+ | Open for append; open for update at the end of the file, or create if the file does not exist. |
whence | File location |
SEEK_SET | File beginning |
SEEK_CUR | Current file pointer position |
SEEK_END | End-of-file |
0 | no error |
1 | no such file entry |
2 | I/O error |
3 | not a serial device |
4 | out of memory |
5 | permission denied |
6 | block device required |
7 | no such device |
8 | invalid argument |
9 | file table is full |
10 | device directory is full |
11 | no space left on device |
12 | no more allocation blocks |
13 | no more data blocks on device |
14 | file is open |
15 | no RAM space configured |
16 | no heap space configured |
17 | seek can't extend read only file |
18 | bad file descriptor - file not open |
19 | invalid signal number |
20 | argument out of range |
21 | result out of range |
typedef struct | |
{ | |
char *fpos; | // Current position of the file pointer (absolute address) |
void *base; | // Pointer to the base of the file |
unsigned int handle; | // File handle |
int flags; | // Flags (see FileFlags) |
int unget; | // One-byte buffer for ungetc (b15=1 if there is a byte in it) |
int alloc; | // Number of currently allocated bytes for the file variable |
} FILE; |