Computer Science, asked by crick21, 1 month ago

Write the syntax of a file with an example​

Answers

Answered by darksoul26
5

Answer:

Opening a file is performed using the fopen() function defined in the stdio. h header file. The syntax for opening a file in standard I/O is: ptr = fopen("fileopen","mode");

Explanation:

Answered by totaloverdose10
3

Answer:

Explanation:

To create a file in a 'C' program following syntax is used,

FILE *fp;

fp = fopen ("file_name", "mode");

In the above syntax, the file is a data structure which is defined in the standard library.

fopen is a standard function which is used to open a file.

If the file is not present on the system, then it is created and then opened.

If a file is already present on the system, then it is directly opened using this function.

fp is a file pointer which points to the type file.

Example:

#include <stdio.h>

int main() {

FILE *fp;

fp  = fopen ("data.txt", "w");

}

Similar questions