You need to seek to the end of the file and then ask for the position:
(您需要寻找文件的末尾然后询问位置:)
fseek(fp, 0L, SEEK_END);
sz = ftell(fp);
You can then seek back, eg:
(然后你可以回头,例如:)
fseek(fp, 0L, SEEK_SET);
or (if seeking to go to the beginning)
(或者(如果想要开始))
rewind(fp);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…