The AsciiIo object can be used to read and write text files within the AX runtime environment.It returns a container with the data in each line in the text file. That could be useful if you are reading a CSV file.In the following example I convert the container into text string and print it as an info message, line after line:
void Testmethod()
{
AsciiIo readFile;
str line;
Container fileRecord;
;
readFile = new AsciiIo("C:\\test.txt",'R');
readFile.inFieldDelimiter("1234567890abcdefghijklmnop");
fileRecord = readFile.read();
while(fileRecord)
{
line = con2str(fileRecord);
info(line);
fileRecord = readFile.read();
}
}
No comments:
Post a Comment
Leave your comments and solutins