I made a tool in Delphi to create rainbow table. It was fine until file grew up to 3.1 GB. I closed my program. Then i opened it again and it crashes while executing this code:
Assign(RainbowFile,'Rainbow_table.txt'); {assign a text file}
Append(RainbowFile);
Delphi shows error "raised expection class EInOutError with message 'I/O error 131'. My question: how to append data to existing file bigger than 2 GB. // Obsolete Next question: I have currently code:
Content_to_file := (#13+#10+Start_string+':'+hexstr(GTA_San_Andreas_CRC32(Start_string), 8));
RainbowFile_handle.WriteBuffer( Content_to_file[1], Length(Content_to_file)*SizeOf(Char));
How to get rid of Content_to_file variable. I want put it directly to the WriteBuffer if it`s possible.
EDIT:
TFileStream works with files bigger than 2 GB. I tested it now. However is it possible to write so:
RainbowFile_handle.WriteBuffer( Start_string[1]+':',
I mean to pass no variable argument. Or do i have definitely pass first char of variable?
EDIT 2:
I have currently made it this way:
Content_to_file := (#13+#10+Start_string+':'+hexstr(GTA_San_Andreas_CRC32(Start_string), 8));
RainbowFile_handle.WriteBuffer( Content_to_file[1], Length(Content_to_file)*SizeOf(Char));
Is it possible to do it without this variable?
You should switch to streams. A TFileStream
will handle this without problems. Note that if you use random access then you must ensure you use the 64 bit versions of Seek
and Position
.
After you have opened the file stream you can seek to the end:
Stream.Seek(0, soEnd);
Then you can write lines as so:
procedure StreamWriteLine(Stream: TFileStream; Text: string);
begin
Text := Text + sLineBreak;
Stream.WriteBuffer(Text[1], Length(Text)*SizeOf(Char));
end;
Hopefully, that should give you enough clues to fill in the rest of the details.
Plain procedure I/O is not suitable for modern operations. Just use TFileStream
class, or, if you need fine control, use Windows API directly (read about CreateFile
and WriteFile
functions).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With