qfedu-c-level/lyric_analysis/srcs/lrc.c

20 lines
516 B
C
Raw Normal View History

#include "./includes/lrc.h"
FILE *open_lrc_file(const char *lrc_path)
{
FILE *fp = fopen(lrc_path, "rb");
if (fp == NULL)
{
return NULL;
}
return fp;
}
long get_lrc_size(FILE *fp)
{
fseek(fp, 0, SEEK_END); // fseek()将文件指针移动到文件末尾
long size = ftell(fp); // ftell()返回当前文件指针位置, 即文件大小
rewind(fp); // rewind()将文件指针移动到文件开头
printf("歌词大小为: %ld Byte\n", size);
return size;
}