请教个问题,一个textfile文件如何清除里面的内容??

jackie_cisco 2005-09-12 08:00:44
一个textfile文件如何清除里面的内容,使用什么方法呢??
assign(passfile,'c:\password.txt');

如何清楚passfile文件内容。
...全文
59 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ztenv 2005-09-12
  • 打赏
  • 举报
回复
assign(passfile,'c:\password.txt');
rewrite(passfile);
closefile(passfile);
就可以了;
yeweimian1 2005-09-12
  • 打赏
  • 举报
回复
什么叫清楚???还是清除???


要清除还不方便么。你把原来的文件删除了。再建立个新文件(但是什么都不写)。名字叫原来哪个不就OK了么。

DELPHI的文件I/O函数:
Append Opens an existing text file for appending.
AssignFile Assigns the name of an external file to a file variable.
BlockRead Reads one or more records from an untyped file.
BlockWrite Writes one or more records into an untyped file.
ChDir Changes the current directory.
CloseFile Closes an open file.
Eof Returns the end-of-file status of a file.
Eoln Returns the end-of-line status of a text file.
Erase Erases an external file.
FilePos Returns the current file position of a typed or untyped file.
FileSize Returns the current size of a file; not used for text files.
Flush Flushes the buffer of an output text file.
GetDir Returns the current directory of a specified drive.
IOResult Returns an integer value that is the status of the last I/O function performed.
MkDir Creates a subdirectory.
Read Reads one or more values from a file into one or more variables.
Readln Does what Read does and then skips to beginning of next line in the text file.
Rename Renames an external file.
Reset Opens an existing file.
Rewrite Creates and opens a new file.
RmDir Removes an empty subdirectory.
Seek Moves the current position of a typed or untyped file to a specified component. Not used with text files.
SeekEof Returns the end-of-file status of a text file.
SeekEoln Returns the end-of-line status of a text file.
SetTextBuf Assigns an I/O buffer to a text file.
Truncate Truncates a typed or untyped file at the current file position.
Write Writes one or more values to a file.
Writeln Does the same as Write, and then writes an end-of-line marker to the text file.

2,496

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 数据库相关
社区管理员
  • 数据库相关社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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