AssignFile procedureAssociates the name of an external file with a file variable.ChDir procedureChanges the current directory.CloseFile procedureTerminates the association between file variable and an external disk file.CreateDir functionCreates a new directory.DeleteFile functionDeletes a file from disk.DirectoryExists functionDetermines whether a specified directory exists.DiskFree functionReturns the number of free bytes on a specified drive.DiskSize functionReturns the size, in bytes, of a specified drive.File mode constantsUsed to open and close disk files.File name constantsFile name constants are used to express file names in a platform-independent manner.File open mode constantsFile open mode constants are used to control the access mode to a file or stream.FileAccessRights variablePoints to the command-line arguments specified when the application is invoked.FileAge functionReturns the OS timestamp of a file.FileClose procedureCloses a specified file.FileCreate functionCreates a new file.FileDateToDateTime functionConverts an OS timestamp value to TDateTime value.FileExists functionTests if a specified file exists.FileGetAttr functionReturns the file attributes of FileName.FileGetDate functionReturns an OS timestamp for a specified file.FileIsReadOnly functionReports whether a file is read-only.FileOpen functionOpens a specified file using a specified access mode.FileRead functionReads a specified number of bytes from a file.FileSearch functionSearches a specified directory path for a file.FileSeek functionRepositions read/write point.FileSetAttr functionSets the file attributes of a specified file.FileSetDate functionSets the OS time stamp for a specified file.FileSetReadOnly functionSets the file permissions to read-only.FileWrite functionWrites the contents of a buffer to the current position in a file.FindClose procedureReleases memory allocated by FindFirst.FindFirst functionSearches for the first instance of a file name with a given set of attributes in a specified directory.FindNext functionReturns the next entry matching the name and attributes specified in a previous call to FindFirst.ForceDirectories functionCreates a new directory, including the creation of parent directories as needed.GetCurrentDir functionReturns the name of the current directory.GetDir procedureReturns the current directory.RemoveDir functionDeletes an existing empty directory.RenameFile functionChanges a file name.SetCurrentDir functionSets the current directory.
看看delphi帮助吧... procedure OpenForShare(const FileName: String); var FileHandle : Integer; begin FileHandle := FileOpen(FileName, fmOpenWrite or fmShareDenyNone); if FileHandle > 0 then {valid file handle} else {Open error: FileHandle = negative DOS error code} end;
看看delphi帮助吧... procedure OpenForShare(const FileName: String); var FileHandle : Integer; begin FileHandle := FileOpen(FileName, fmOpenWrite or fmShareDenyNone); if FileHandle > 0 then {valid file handle} else {Open error: FileHandle = negative DOS error code} end;
var F: File of Byte; ch: Byte; begin Assignfile(F,'YourFileName'); reset(F); //读,写用Rewrite(F); Read(F,ch); //每次读一字节,写用Write(F,Ch); CloseFile(F); end;
procedure OpenForShare(const FileName: String);
var
FileHandle : Integer;
begin
FileHandle := FileOpen(FileName, fmOpenWrite or fmShareDenyNone);
if FileHandle > 0 then
{valid file handle}
else
{Open error: FileHandle = negative DOS error code}
end;
procedure OpenForShare(const FileName: String);
var
FileHandle : Integer;
begin
FileHandle := FileOpen(FileName, fmOpenWrite or fmShareDenyNone);
if FileHandle > 0 then
{valid file handle}
else
{Open error: FileHandle = negative DOS error code}
end;
F: File of Byte;
ch: Byte;
begin
Assignfile(F,'YourFileName');
reset(F); //读,写用Rewrite(F);
Read(F,ch); //每次读一字节,写用Write(F,Ch);
CloseFile(F);
end;