Objective-C lyrics parsing, objective-c Parsing

Source: Internet
Author: User

Objective-C lyrics parsing, objective-c Parsing

# Import <Foundation/Foundation. h> int main (int argc, const char * argv []) {FILE * fp1; // defines the FILE pointer for reading the FILE char * fp2; // used to judge whether the lyrics have been read char s [80]; // temporarily saved lyrics long int time2 = 0; long int time = 0; // used to calculate the time, accurate to seconds, not perfect, hope the high person points int a = 1; // plays a judgment role fp1 = fopen ("/Users/qingyun/Desktop/Dream. lrc "," r "); // opened in Direct Read mode. The path can be macro-defined fgets (s, 1000, fp1); // For the output name while () {a ++; if (s [a] = ']') {break;} s [a] = '\ 0'; printf ("song name: % s \ n ", & s [3]); sleep (3 ); Fgets (s, 1000, fp1); // to output singer name a = 1; while (a) {a ++; if (s [a] = ']') {break ;}} s [a] = '\ 0'; printf ("singer: % s \ n", & s [3]); sleep (3 ); fgets (s, 1000, fp1); // because some lyrics have other attributes, only the song name and singer name are output for compatibility, followed by the lyrics while (s [1]! = '0') {fgets (s, 1000, fp1);} while (fp2! = NULL) // judge whether the lyrics have been read {time = (s [1]-'0') * 60000 + (s [2]-'0 ') * 6000 + (s [4]-'0') * 1000 + (s [5]-'0') * 100 + (s [7]-'0 ') * 10 + (s [8]-'0') * 1; printf ("% s", & s [10]); while (time> time2) {sleep (1); time2 + = 100;} fp2 = fgets (s, 1000, fp1) ;}fclose (fp1); // close the file return 0 ;}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.