Skip to content

Rezamollaei/Read_Write_File

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Your program includes multiple parts: writing and reading from text files, and working with binary files. Let me go over each section of your code and offer some suggestions for improvement.

  1. Writing to a Text File The section where you're writing user inputs to a text file looks good, but there is a potential issue with the use of scanf("%d %29s", &num, &name). The %29s format specifier limits the size of the name array to 29 characters, but since name is already declared with a size of 30, this works fine. However, you should be cautious about exceeding the array size in more complex scenarios.

  2. Working with Binary Files You are writing and reading binary data using the fwrite() and fread() functions. However, there is an issue with how you open the binary file for reading. The binary file is opened for writing ("wb"), but it is never reopened in "rb" mode to read from it after the first write.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors