Both C and C++ define high-level interfaces to file manipulation,
independent of any particular O/S. Code written using these
interfaces is usually portable to any O/S.
C defines an opaque data structure of type
FILE
that
you never need to look into. Functions that use this include
# include <stdio.h>
FILE *fopen(char *path, char *type);
int remove(char *path);
int fclose(FILE *fp);
Once a file has been opened there are a variety of functions to read/write
such as
#include <stdio.h>
fprintf(FILE *fp, char *format, ...);
int fputc(char c, FILE*fp);
int fgetc(FILE *fp);
All the C functions for I/O are available in C++. In addition, C++
has the iostream
classes with their associated methods.
These allow you to create, open, close, rad and write files.