File processing in C: counting lines and characters

preview_player
Показать описание
An example program using fgets and file handles to do simple processing on a file.

This video uses an online compiler to demonstrate how to quickly set up and test a basic program.

There are several good choices for online C environments. This video uses “Paiza” because my university finds that the interface is good for both Japanese and international students.

0:00 Intro: the word "file" comes from the French for "wire"
0:15 Programs can manipulate text or data
0:29 Three C basics: file pointers, fopen() and fclose()
0:55 Example in Paiza
1:11 Using the "+" tab to add the files we want to do counting for
1:43 A simple while loop using fgets
2:12 Calling fgets(ss, n, fp) reads n-1 characters

#Cprogramming #日本語字幕

J captions credit: Yuto Hayakawa

For the history of "file" coming from the word for "wire", see for example this 1607 quote: "File (filacium) is a threed or wyer, whereon writs, or other exhibits in courts, are fastened for the better keeping of them."

You see where English got the phrasing "on file"...

Note that as far as I know, Paiza does not have a split-screen mode. The visuals in the video are re-arranged to allow for large fonts and room for captions.

Other resources:

(Creative Commons 4.0 licence)

Soundtrack: Will You Dance with Me
Song by Lalinea

► Support the chanel
Like: Give a 👍 to this video (thanks!)
Рекомендации по теме