티스토리 뷰
FileCopy
출처 : http://delphi.about.com/od/fileio/a/untypedfiles.htm
procedure FileCopy(const FileFrom, FileTo: string) ;
var
FromF, ToF: file;
NumRead, NumWritten: Integer;
Buffer: array[1..2048] of Byte;
begin
AssignFile(FromF, FileFrom) ;
Reset(FromF, 1) ;
AssignFile(ToF, FileTo) ;
Rewrite(ToF, 1) ;
repeat
BlockRead(FromF, Buffer, SizeOf(Buffer), NumRead) ;
BlockWrite(ToF, Buffer, NumRead, NumWritten) ;
until (NumRead = 0) or (NumWritten <> NumRead) ;
CloseFile(FromF) ;
CloseFile(ToF) ;
end;
Random access file
출처 : http://www.tek-tips.com/viewthread.cfm?qid=1540019&page=3
type
recordtype=record
varLastName :string[50];
varFirstName :string[50];
varEmail :string[250];
end;
qfile:file of recordtype;
qfileTemp:file of recordtype;
qrecord:recordtype;
numrec:integer;
numtemp:integer;
procedure TfrmDataBase.imgDeleteMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
try
ASSIGNFILE(qfile, Trim(lblFile.Caption));
Reset(qfile);
ASSIGNFILE(qfiletemp, ExtractFilePath(application.exename) + '\Database.tmp');
REWRITE(qfiletemp);
For numtemp:=0 To filesize(qfile)-1 Do
begin
seek(qfile,numtemp);
read(qfile,qrecord);
If IntToStr(numtemp + 1) <> Trim(lblPosition.Caption) Then
begin
write (qfiletemp, qrecord);
end;
end;
closefile(qfile);
closefile(qfiletemp);
deletefile(Trim(lblFile.Caption));
renamefile(ExtractFilePath(application.exename) + '\Database.tmp', Trim(lblFile.Caption));
except
ShowMessage('Warning: access to file has been denied.' + #10 + #13 + #10 + #13 + 'Make sure the application folder is not read-only.');
exit;
end;
end;
- Total
- Today
- Yesterday
- 동경
- flex
- Spring MVC
- ffmpeg
- Java
- ubuntu
- Mac
- KOBA
- NDK
- Delphi Tip
- 튜닝쇼 2008
- BPI-M4
- 일본여행
- 서울오토살롱
- Spring
- oracle
- JavaScript
- ble
- MySQL
- SAS
- 송주경
- sas2009
- Linux
- android
- koba2010
- Delphi
- Xcode
- 지스타2007
- 전예희
- 레이싱모델 익스트림 포토 페스티벌
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |