Read text file … alternative way to read all lines in one operation
Views (740)
Hi, sometimes could be useful read files in one bulk operation directly from filesystem to an object and after managed this last one.
Below I’ve reported my experience, hoping could be interesting for all.
boolean loadFileInContainer()
{
ItemId item;
List buffer = new List(Types::Container);
System.Array lines;
int totLines;
try
{
lines = System.IO.File::ReadAllLines();
totlines = lines.get_Count();
for(i=0;i<totlines; i++)
{
[item] = Global::str2con(lines.GetValue(i),';');
buffer.addEnd([item]);
}
}
catch
{
return false;
}
return true;
}
bye!

This was originally posted here.
*This post is locked for comments