Text file processing

gavrishanchor
Member Posts: 10
Hi,
Is there any funtion available to find no. of lines in a text file. i opened up a text file and set TEXTMODE(True), now how can i find no. of lines in that file (dont want to use LEN function but want to know the end of text file).
thanks in advance
Is there any funtion available to find no. of lines in a text file. i opened up a text file and set TEXTMODE(True), now how can i find no. of lines in that file (dont want to use LEN function but want to know the end of text file).
thanks in advance
0
Comments
-
Also how to check whether particular file is already opened or not.0
-
Hej gavrishanchor
1. No. of lines in a text-file
As stated in the online helpTEXTMODE (File)
This function is used to set whether a file should be opened as an ASCII file or a binary file. The function can also be used to determine what the current setting of this option is for a file.
There is - AFSIK - no way of knowning the number of lines in the file upfront.
2. If a file is in use ?
The only way I'm aware of, is to copy/rename the file.
If that succeeds, the file is yours.
You can use the RENAME/COPY file commands (check F5 - CA/L Symbol Menu under FILE).
Hope this will help you. May I ask to what you need this ?With Kind Regards
Thoms Hviid Thorn0 -
Hi Thomas,
Thank you so much. anyway i manage to get what i really want.0 -
gavrishanchor wrote:Also how to check whether particular file is already opened or not.
IF NOT FileToBeRead.OPEN('The Name') THEN BEGIN ERROR('File is in use'); END;
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hi,
I have to read till the end of the file. How do I find that out?
I was trying to check CharCount returned by READ method and stopping when it's zero.The problem with this approach is that if the file has an empty line then the code thinks that the file has ended and does not read all the lines after that.
count := file.read(line);
while count > 0 do
begin
....
.....
count := file.read(line);
end;0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions