![]() ![]() This space will then be used by FS.Read later to storeĭata extracted from the filestream. Is important to declare the X var at the start, since this will ensure ![]() ![]() It will then show a message of the first character in the text file.įinally we free the filestream which ensures there is no memory leak. It will start at the current position (in this case 0) and then read the number of bytes specified (in this case 2) and it will store these bytes in memory at a given location (in this case X). It will then perform a Read on the string. what is my start point in the stream (it's 0 by default but if you wanted to alter your start point, this is how you'd do it). It will then set the position of the filestream to 0, i.e. This will create a filestream based on the information fed to the constructor, i.e. Procedure TForm1.Button1Click(Sender: TObject) įS := TFileStream.Create('C:\Temp\Example.txt', fmOpenRead) Below is a very simple example illustrating how to locate a character in a filestream: TFileStream can be handy for looking at a file without having to actually load it into memory since it just provides a more efficient way to view it on disk. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |