Home > Back-end >  How to use c language statistics all the TXT file in a folder sum total of the number of words
How to use c language statistics all the TXT file in a folder sum total of the number of words

Time:03-09

Ask bosses guide


How to use c language statistics all the TXT file in a folder sum total of the number of words

CodePudding user response:

Start -- opendir -- readdir (. TXT file, the processing, the. TXT, skip, directory, recursively,) - end

CodePudding user response:

Condition is very complex, folder may include folder, there may be multiple folders, need to deal with the recursive, perl/python with glob processing, if you must use the C language, you need to achieve glob and regular expression functions,

CodePudding user response:

The role of glob is to obtain the TXT file name;
Regular expression is used to calculate words;

CodePudding user response:

The
reference 3 floor proorck2019 response:
glob's role is to obtain the TXT file name;
Regular expression is used to calculate words;

Kill the goose that how to use the wheel

CodePudding user response:

A difficulty, the problem is that characters judgment, if are in English, or Chinese, good processing, if mixed in both English and Chinese, need according to TXT encoding process

CodePudding user response:

refer to fifth floor truth is right or wrong response:
this question has a difficulty, is the judgment of the characters, if you are in English, or Chinese, good processing, if mixed in both English and Chinese, need according to TXT coding processing

Yes, that's so, you need to determine coding,

Such as English: utf-8, 3 bytes, GBK, 2 bytes,

CodePudding user response:

The text are in English, the topic below
Teacher shows the part of c code, we to stop delete folder TXT, now just want to know how to calculate the folder 112 TXT file due to the stop delete, reduce how much is the percentage of file number?

CodePudding user response:

Directory of open, readdir shutdown and opening of the file to read and so on, suggested the landlord to find out the system calls the function ~
  • Related