answersLogoWhite

0

How files are created and used in c?

User Avatar

Anonymous

∙ 16y ago
Updated: 8/17/2019

Files are created and used in C with the stdio library functions fopen, fread, fwrite, fprintf, fscanf, fclose, etc. A trivial example that writes one line to a file...

FILE *file;

file = fopen ("somefile.txt");

if (file == null) { ... error code ... } else

fprintf (file, "This is a line of data in a file\n");

fclose (file);

}

This will create and write a standard "text" file that can be subsequently opened with a standard text editor such as notepad (windows) or vi (unix).

User Avatar

Wiki User

∙ 16y ago
User Avatar

What else can I help you with?

Related Questions

How many files are created in c when we execute a program?

Zero or more.


Explain about header files used in c language?

list of header files in c and function prototype associated with each file


What Linux command is used for displaying all files with extension .c?

ls *.c


What is the purpose of the c windows csc folder?

It is used to store offline files and folders


What is tlink in c plus plus compiler?

TLINK is the Turbo C++ linker utility. You use it to link the object files created by the Turbo C++ compiler.


How many files are created for c program when execute the program?

That's entirely up to the programmer. A program could create 0 files or 50 million files (or any number in between).


Header files used in c programs usually found in?

Directories, like /usr/include or C:\MYCOMPILER\INCLUDE


Header files in Java programming?

Java does not require header files like C/C++.


What does the hashtag mean in programming?

In programming, specifically in C and C++, the hashtag (#) is used to include files into the main program and to create macros.


What is the use of header files as used in C programming?

Header files are used to have declarations. It is simple to include a single header file than writing all the needed functions prototypes.


Can include files be nested in c?

Yes, include files can be nested in C and C++. In fact, most library implementations do just that.


Why you write include in c plus plus?

The #include statement in C and C++ is used to incorporate (include) a file in the compilation unit at the point where the #include statement is encountered. It is used to incorporate commonly used files, often (but not always) rarely changed files, so that the developer does not need to incorporate common code more than once in a project.