You can only paste the Code . Please note:
# Include <stdio. h> # include <string. h> # include <assert. h> # define strlen 256 // only remove the time mark char * parse_lrc_line (char * Line) {char * P = NULL; P = strrchr (line, ']'); if (P = NULL) {goto end;} p = p + 1; end: Return P;} // parse the string of the LRC file containing the time tag in it, and output it to stdout. Slight modification is of practical value (encoding or modification) void parse_lrc_line2 (char * Line) {char * P = NULL; char * Right = NULL; char * Left = NULL; char buff [strlen] = {0}; char * P2 = NULL; int N; P = line; // le FT is the left [location left = strchr (p, '['); If (Left = NULL) {return ;} // right is the right] location right = strchr (p, ']'); While (right! = NULL & left! = NULL) {n = right-left-1; strncpy (buff, left + 1, n); puts (buff); P2 = strrchr (p, ']'); if (P2! = NULL) {P2 ++; puts (P2) ;}// you can save the lyrics and time tag information here. The time tag is buff, the lyrics are P2 // here, the buff is cleared to \ 0 .. In this case, you do not need to calculate the string length and add \ 0 to memset (buff, '\ 0', n); P = right; // The strchr function only searches backward, divide this string into two types: * P = '\ 0'; P = p + 1; left = strchr (p,' ['); If (Left = NULL) {continue;} Right = strchr (p, ']') ;}} int main () {file * f = NULL; char line [strlen] = {0 }; F = fopen ("qclg. LRC "," R "); Assert (f); While (fgets (line, strlen, f )) {// parse_lrc_line is the printf (parse_lrc_line (line);} rewind (f); // read each row and parse while (fgets (line, strlen, f) {// parse_lrc_line2 (line);} getchar (); fclose (f );}