Join Eduardo Corpeño for an in-depth discussion in this video File access example, part of C Standard Library.
- [Instructor] Now let's see an application…that reads from a file and writes…into the same file.…I will use Get C to read each character from the file…and I will use F Print F to write…something into the file.…And what I want to do is to print out…the exact file to the screen,…so what I will do is read each character from the file…and send it out to the screen.…And later, I will report in the file…how many characters I found.…
That's why you can see an integer variable…called Counter in line four.…So, let's get started.…So first let me declare a file variable,…which will actually be a pointer called f…and I will assign a new file to it…by means of the f open function.…Now remember, this function takes in two strings.…The first one is the file name…and I will name this file names.txt…I already have a file with a bunch of names…available for this.…
And the second argument is the access mode.…For this example, I will use r+…which means reading access with added writing access.…Now let me declare a new character variable we shall call C…
- Working with header files
- C constants and types
- Unformatted and formatted input/output
- Accessing files with C functions
- Generating random numbers
- Converting strings
- Sorting and searching for data
- Manipulating strings
- Using mathematical functions
Skill Level Intermediate
1. The C Standard Library
2. Input and Output Library: stdio.h
3. General Purpose: stdlib.h
4. String Functions: string.h
5. Mathematical Functions: math.h
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.