I'd like to open a file from a codeunit. But first I have to check the number of the lines in the file.
I created a Var of File. This case the LEN parameter is the size of the file and not the number of rows. This not good for me.
I'd like to check the number of rows in simple.
IF (aFile.POS=aFile.LEN) AND (BytesRead = 0) THEN BEGIN
aFile.CLOSE;
EXIT(NoOfLines);
Hi...,
i've just tried the function, and it does return the number of line but I still got an error "The file is not open". Do you have any idea? I didn't use Return Value.
Comments
If you perform a sequential read to the file, i.e. from a dataport, you can add an int var and on the OnAfterGetRecord increase it.
You can use the same concept anytime you read or write to a file...
It is either simple, or I didn't got your question.
Arhontis
https://forum.mibuso.com/search
I created a Var of File. This case the LEN parameter is the size of the file and not the number of rows. This not good for me.
I'd like to check the number of rows in simple.
Summary: how many rows in a text file? :?:
If it is essential to have the number of lines, then you could build a function like:
and call it from your code prior reading the file.
It was "fast made" but returns the no of lines in a file...
It took a couple of secs to count about 50000 lines of a file.
Can't think anything else...
Arhontis
https://forum.mibuso.com/search
Great!
Hi...,
i've just tried the function, and it does return the number of line but I still got an error "The file is not open". Do you have any idea? I didn't use Return Value.
Case closed.