SLAU132V October 2004 – February 2020
The high-level functions are the standard C library of stream I/O routines (printf, scanf, fopen, getchar, and so on). These functions call one or more low-level I/O functions to carry out the high-level I/O request. The high-level I/O routines operate on FILE pointers, also called streams.
Portable applications should use only the high-level I/O functions.
To use the high-level I/O functions, include the header file stdio.h, or cstdio for C++ code, for each module that references a C I/O function.
For example, given the following C program in a file named main.c:
#include <stdio.h>
void main()
{
FILE *fid;
fid = fopen("myfile","w");
fprintf(fid,"Hello, world\n");
fclose(fid);
printf("Hello again, world\n");
}
Issuing the following compiler command compiles, links, and creates the file main.out from the run-time-support library:
cl430 main.c --run_linker --heap_size=400 --library=rts430_eabi.lib --output_file=main.out
Executing main.out results in
Hello, world
being output to a file and
Hello again, world
being output to your host's stdout window.