Skip to content

Rezamollaei/File_handling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This program demonstrates various C file I/O and standard input/output operations while using constants and basic arithmetic. It reads from ../Input.txt and writes processed content to ../Output.txt.

Purpose: Illustrates file I/O, standard input/output, and string/character processing. How It Works: File Handling:

Opens ../Input.txt for reading and ../Output.txt for writing. Handles file opening errors with error messages. Standard Input/Output:

Reads an integer, a character, and a string from the user. Outputs them using printf, putchar, and puts. Casting and Arithmetic:

Performs a calculation involving a constant (PINUMBER) and user input, demonstrating type casting. File Copying:

Character-by-Character Copy: Uses fgetc to read characters and fputc to write them to ../Output.txt. Line-by-Line Copy: Uses fgets to read and fputs to write lines, appending newlines for clarity. Word-by-Word Copy: Reads words with fscanf and writes them using fprintf. Rewind:

Resets the file pointer to the beginning of the input file before each new operation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors