I have borrowed code that I don't understand but it serves my purpose. The code saves Text data in a TFile, i.e. MyNewStuff.txt. I want to put it into a TSringlist pronto. Immediately after saving the TFile and closing same, is the data still in memory when I say "MyTStringlist.loadfromfile('MyNewStuff.txt');" Does it require a hard drive access to do the above. I want to avoid multiple HD accesses.

Not a polished Delphi programmer but Thank You just the same,

Vern

Can you post a snippet of the saving procedure?

If you have the text data in a string, you can use the Text property of TSringList to load it into the TSringList object.

Can you post a snippet of the saving procedure?

If you have the text data in a string, you can use the Text property of TSringList to load it into the TSringList object.

- - - - - - - - - - - - - - - - - - -

Below is the example. I don't need to save the info to HD as it is only temporarily useful.
TU for your interest in my problem.

Vern

- - - - - - - - - - - - - - - - - - -

function GetInetFile (const fileURL, FileName: String): boolean;
const
BufferSize = 1024;
var
hSession, hURL: HInternet;
Buffer: array[1..BufferSize] of Byte;
BufferLen: DWORD;
f: File;
/ sAppName: string;
begin
result := false;
sAppName := ExtractFileName(Application.ExeName) ;
hSession := InternetOpen(PChar(sAppName), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0) ;
//fts.Clear;
try
hURL := InternetOpenURL(hSession, PChar(fileURL), nil, 0, 0, 0) ;
try
AssignFile(f, FileName) ;
Rewrite(f,1) ;
repeat
InternetReadFile(hURL, @Buffer, SizeOf(Buffer), BufferLen) ;
BlockWrite(f, Buffer, BufferLen)
until BufferLen = 0;
CloseFile(f) ;

//**************** My code *************************
fts.Clear; // fts is a TStringlist, it was created earlier
fts.loadfromfile(filename); // load it here. Note: it would be nice to to put
// BlockWrite data (above) directly into fts!
//****************End My code **********************

result := True;
finally
InternetCloseHandle(hURL)
end
finally
InternetCloseHandle(hSession)
end

This article has been dead for over six months. Start a new discussion instead.