请问vc中有哪个函数可以直接读文件的某一行的?

litimage 2004-01-16 09:45:34
请问vc中有哪个函数可以直接读文件的某一行的?
...全文
109 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
shuihersina 2004-04-09
  • 打赏
  • 举报
回复
学习
黄双全 2004-01-16
  • 打赏
  • 举报
回复
不可能不读前几行直接读到第三行,判断行是用读到回车换行符来判断的。一定要每个字符都读一次。
litimage 2004-01-16
  • 打赏
  • 举报
回复
“读一次换一行。你要是读第3行就读3次”
是不是浪费效能呵?
litimage 2004-01-16
  • 打赏
  • 举报
回复
我不想读前面几行,就想直接读到指定行。
那咋办呢?
litimage 2004-01-16
  • 打赏
  • 举报
回复
m_hFile Usually contains the operating-system file handle.


Construction

CFile Constructs a CFile object from a path or file handle.
Abort Closes a file ignoring all warnings and errors.
Duplicate Constructs a duplicate object based on this file.
Open Safely opens a file with an error-testing option.
Close Closes a file and deletes the object.


Input/Output

Read Reads (unbuffered) data from a file at the current file position.
ReadHuge Can read more than 64K of (unbuffered) data from a file at the current file position. Obsolete in 32-bit programming. See Read.
Write Writes (unbuffered) data in a file to the current file position.
WriteHuge Can write more than 64K of (unbuffered) data in a file to the current file position. Obsolete in 32-bit programming. See Write.
Flush Flushes any data yet to be written.


Position

Seek Positions the current file pointer.
SeekToBegin Positions the current file pointer at the beginning of the file.
SeekToEnd Positions the current file pointer at the end of the file.
GetLength Retrieves the length of the file.
SetLength Changes the length of the file.


Locking

LockRange Locks a range of bytes in a file.
UnlockRange Unlocks a range of bytes in a file.


Status

GetPosition Retrieves the current file pointer.
GetStatus Retrieves the status of this open file.
GetFileName Retrieves the filename of the selected file.
GetFileTitle Retrieves the title of the selected file.
GetFilePath Retrieves the full file path of the selected file.
SetFilePath Sets the full file path of the selected file.


Static

Rename Renames the specified file (static function).
Remove Deletes the specified file (static function).
GetStatus Retrieves the status of the specified file (static, virtual function).
SetStatus Sets the status of the specified file (static, virtual function).
osborn 2004-01-16
  • 打赏
  • 举报
回复
CStdioFile

ReadString : Reads a single line of text.
WriteString : Writes a single line of text.
windyloft 2004-01-16
  • 打赏
  • 举报
回复
ReadString()
读一次换一行。你要是读第3行就读3次
windyloft 2004-01-16
  • 打赏
  • 举报
回复
CFile.GetString()

15,979

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧