需要一些帮助阅读文件
Need some Help Reading File
我需要读取一个文件(不是在二进制模式下)。我已经有了一个代码来知道文件的大小,我正在寻找的是如何通过=(文件大小)-8276字节读取文件。这些已读取的字节将存储在变量中,我需要写入它。
文件的大小存储在无符号长变量中。有人可以帮助我吗?
我使用博兰德C++
试试这个。自从我接触 Borland 以来已经有一段时间了,所以语法可能有点不对劲。将其视为伪代码,但您了解了概念。
// assuming you've already created the file handle.
HANDLE fileHandle;
unsigned long fileSize;
unsigned long numBytesRead;
bool result;
// get the file size
fileSize = GetFileSize(theFile, NULL);
// check to see if filesize is greater than 8276 bytes.
// if so, read (fileSize - 8276)
if(fileSize >= 8276)
{
result = ReadFile(fileHandle, &objectYouAreReadingItTo, (fileSize - 8276), numBytesRead);
}
else
{
//...handle when fileSize is less than 8276 bytes...
}
相关文章:
- 在指针的帮助下,文本文件中单词的频率
- 可以在JSON文件的帮助下在Qt中创建UI表单
- 我需要帮助以连续的方式将对象的字段正确写入文件
- cmake:构建依赖于非源文件.Qt帮助生成
- C 需要帮助的作业程序,该程序在文件列表中读取并在每个双重的双重列表中添加一个字符串
- 使用带有 MEX 包装器的帮助程序 C 文件从 MATLAB 2016 调用C++代码时出现问题
- 写入文件时需要帮助获取新行
- C 读取/写入两个不同的文件(需要帮助了解要使用的语法)
- 需要帮助 在文本文件中随机生成 54 副牌
- C++:帮助存储和显示输入文件变量
- 使文件没有运行,请帮助我
- 需要帮助从文件中获取字符和整数数据
- 我需要一些帮助以有组织的方式格式化文件
- 帮助程序函数应该放在标头中还是在实现文件中
- 我需要帮助为C++设置.gitlab-ci.yml文件
- 需要帮助理解c++.h文件
- 从数据实时创建WAV文件 - 需要帮助
- 在头文件中实现帮助程序类
- 需要一些帮助阅读文件
- 需要wxWidgets生成文件帮助