#include <stdio.h> FILE *fopen(const char *name, const char *mode);
fopen
function opens a file and returns a pointer to the
associated FILE
object. The name
argument is the
external name (sometimes called a pathname) of the file to be
opened. Its form is system dependent. The mode
argument is a
string defining how the file will be used. For more information about
open mode values, see Open modes .
fopen
function returns a pointer to a FILE
object associated
with the named file. If the file cannot be opened, a NULL
value is
returned.
a
the second time to add an additional line
to the file:
#include <stdio.h> main() { FILE* test; int c; float a; test = fopen("tso:TEST", "w"); puts("Enter maximum speed limit in miles:"); scanf("%d", &c); fprintf(test, "Maximum speed limit is %d miles/hour.n", c); fclose(test); a = 1.619 * c; test = fopen("tso:TEST", "a"); fprintf(test, "n In km/h, the maximum speed limit is %fn", a); fclose(test); }
afopen
, freopen
, open
Copyright (c) 1998 SAS Institute Inc. Cary, NC, USA. All rights reserved.