Reading Text files
Ruuben
Member Posts: 41
Hello, i'm trying to read a text file line by line, but readtext function is reading character by character. This is the code i'm using:
VarFile.OPEN('C:\FILE.TXT');
VarFile.CREATEINSTREAM(VarInStream);
WHILE NOT VarInStream.EOS() DO
BEGIN
VarInStream.READTEXT(VarText1024);
END;
VarFile.OPEN('C:\FILE.TXT');
VarFile.CREATEINSTREAM(VarInStream);
WHILE NOT VarInStream.EOS() DO
BEGIN
VarInStream.READTEXT(VarText1024);
END;
0
Answers
-
Hi Ruuben,
The code looks fine to me - have you tried to use VarFile.TEXTMODE0 -
Yes, i've tried it but it's the same.. it reads an only character0
-
Hi Ruuben,
:-k Strange indeed - I have tested the code on a Cronus database and it is working fine. Try specifing the Lenght in the Readtxt command or use the Varfile.Read command.0 -
Did you tried to enforce string length by defining a length parameter?0
-
Hi again, first thanks for helping me.. i think i've found one reason why it doesn't work. I'm trying to open a xml file like a text file, in this case readtext function reads character by character. When i've changed the file selected by a normal text file it works correctly.
What i want to do is to change the first line (which is version of xml file) by another different line.
Maybe i could solve this problem by another way.0 -
If are reading an XML file you are probally reading a unicode file. Navision and unicode .... [-o<0
-
0
-
Hi! i've solved it by changing version of xml file in XmlPort from UTF-16 to UTF-8, i don't understand it by it worksss xDDD
thanks!!!!0 -
Because the format of UFT8 it’s different of UTF-16. UTF-8 without any special chars it’s similar to ASCII format so NAV can read it more or less well. Working with UTF18 files it’s double byte so for Navision it’s like a binary file.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
- 322 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