
11.06.2008, 00:15
|
|
Постоянный
Регистрация: 05.01.2007
Сообщений: 508
С нами:
10182506
Репутация:
1393
|
|
Сообщение от t04
В первом случае ты указываешь переместить указатель с которого начнется чтение в файле из которого читаешь, а во втором ты перемещаешь указатель в файле в который пишешь. конечно же ты будешь читать один и тот же байт. вообще попробуй так делать
Код:
var
FromName,
ToName : String;
myfile,
cryptfile : file;
NumRead,
NumWritten: Integer;
OneByte : Byte;
begin
AssignFile(myfile, FromName);
Reset(myfile, 1);
AssignFile(cryptfile, ToName);
Rewrite(cryptfile, 1);
repeat
BlockRead(myfile, OneByte, 1, NumRead);
oneByte:= oneByte+c;
BlockWrite(cryptfile, OneByte, 1, NumWritten);
until (NumRead = 0) or (NumWritten <> NumRead);
CloseFile(myfile);
CloseFile(cryptfile);
end;
Вообще, винапи рулит, зачем такой мазохизм?
Код:
BOOL ReadFile(
HANDLE hFile, // handle of file to read
LPVOID lpBuffer, // address of buffer that receives data
DWORD nNumberOfBytesToRead, // number of bytes to read
LPDWORD lpNumberOfBytesRead, // address of number of bytes read
LPOVERLAPPED lpOverlapped // address of structure for data
);
BOOL WriteFile(
HANDLE hFile, // handle to file to write to
LPCVOID lpBuffer, // pointer to data to write to file
DWORD nNumberOfBytesToWrite, // number of bytes to write
LPDWORD lpNumberOfBytesWritten, // pointer to number of bytes written
LPOVERLAPPED lpOverlapped // pointer to structure needed for overlapped I/O
);
|
|
|