Help on aqTextFile.SetPosition method
My purpose is that write the result into the end of each row in CSV file.
And I write a below script.
function test()
test()
{
var Driver, path;
path=Files["FileNameByName"]("test_csv");
Driver = DDT["CSVDriver"](path);
while (! Driver["EOF"]() )
{
WriteCSV(Project["Variables"]["line"],"T",path);
Project["Variables"]["line"]++;
Driver["Next"]();
}
DDT["CloseDriver"](Driver["Name"]);
}
function WriteCSV(line,result,filepath)
WriteCSV(line,result,filepath)
{
var myFile = aqFile["OpenTextFile"](filepath, aqFile.faReadWrite, aqFile.ctANSI);
var lLength = myFile.LineLength(line)+1;
if (myFile["SetPosition"](line,lLength))
myFile["Write"](result);
myFile["Close"]();
}
The original of Project["Variables"]["line"] is 1.
The problem is that the result of statement "if (myFile["SetPosition"](line,lLength))" is always False
This means I can't move the current cursor to a specific position
Could anybody help me to explain about this and correct it?
Please help me to give another solution if I'm using a incorrect way.
The attachment is file which I want to add the result into the end of each row
Thanks so much.
Hoa.