delphi - Read a text file into an array -


How would I go about reading a text file from a file in a array in memory on the disk?

In addition, I saw using Reed Lane that only the first line (this is obvious, because it is readline, but how do I go about reading the entire text document?)

  function readfile (conf filename: string): string; Var Strings: TStringList; Start String: = TStringList.Create; Try strings. Loadfilefile (filename); Results: = Strings. Text; Finally the strings. free; End; End;   

It gives the contents of the file in a string that can be indexed and such an array can be considered.

Or maybe you want an array instead of string, an array of characters, from which it is easy to use the straight string list: string: TStringList ; ... wire: = TStringList.Create; Try strings. Loadfilefile (filename); // Now strings [0], strings [1], ..., string [strings.count1] can finally use strings. free; End;

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -