std::ifstream is;
is.open(file2.c_str(), std::ofstream::in);
is.seekg(0, ios::end);
int len = is.tellg();
char * df = (char*)malloc(len + sizeof(char));df[0] = '\0';
is.seekg(0, ios::beg);
is.read(df, len);
len = is.tellg();
is.close();
读取一aac文件,不加ios::binary, read后tellg,值为-1,加了ios::binary后值为文件的长度。
本文探讨了使用C++标准库中的ifstream进行文件读取的方法,特别是如何正确地读取二进制文件如AAC音频文件,并解释了使用ios::binary模式的重要性。
3万+

被折叠的 条评论
为什么被折叠?



