subject_47353.htm

来自「vc」· HTM 代码 · 共 12 行

HTM
12
字号
<p>
序号:47353 发表者:白皮 发表日期:2003-07-19 23:31:11
<br>主题:如何利用CreateFile和ReadFile API函数对文件读写?
<br>内容:<BR>利用CreateFile和ReadFile 函数 如何读取数据文件并把数据存入数组中??<BR>CreateFile和ReadFile 函数 中的几个参数如何定义<BR>请给出详细的代码。<BR>谢谢
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:capax 回复日期:2003-07-20 19:04:34
<br>内容:BOOL ReadFile(<BR>&nbsp;&nbsp;HANDLE hFile,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// handle of file to read<BR>&nbsp;&nbsp;LPVOID lpBuffer,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // pointer to buffer that receives data<BR>&nbsp;&nbsp;DWORD nNumberOfBytesToRead,&nbsp;&nbsp;// number of bytes to read<BR>&nbsp;&nbsp;LPDWORD lpNumberOfBytesRead, // pointer to number of bytes read<BR>&nbsp;&nbsp;LPOVERLAPPED lpOverlapped&nbsp;&nbsp;&nbsp;&nbsp;// pointer to structure for data<BR>);<BR> <BR>BOOL WriteFile(<BR>&nbsp;&nbsp;HANDLE hFile,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// handle to file to write to<BR>&nbsp;&nbsp;LPCVOID lpBuffer,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// pointer to data to write to file<BR>&nbsp;&nbsp;DWORD nNumberOfBytesToWrite,&nbsp;&nbsp;&nbsp;&nbsp; // number of bytes to write<BR>&nbsp;&nbsp;LPDWORD lpNumberOfBytesWritten,&nbsp;&nbsp;// pointer to number of bytes written<BR>&nbsp;&nbsp;LPOVERLAPPED lpOverlapped&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// pointer to structure for overlapped I/O<BR>);<BR>
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?