InStream.READ wrong behavior

JAJ
Member Posts: 52
Hi everyone.
I need to process big files in "textmode" = FALSE. I have the code bellow :
InStr = InStream
size = Integer
BigTextFile = BigText
TempText =Text 1024
...
WHILE NOT InStr.EOS DO BEGIN
size := InStr.READ(TempText, 1024);
BigTextFile.ADDTEXT(TempText);
END;
BigTextFile.WRITE(OutStr);
...
With this code if the file is multiple of 1025, it only process 1024 bytes.
If I put the code bellow :
...
WHILE NOT InStr.EOS DO BEGIN
InStr.READ(TempText, 1024);
BigTextFile.ADDTEXT(TempText);
END;
BigTextFile.WRITE(OutStr);
...
I get the error bellow :
The stream cannot find a zero-terminated string.
The stream may be invalid....
Anybody knows what is the problem??
Thanks in advance!
Regards.
I need to process big files in "textmode" = FALSE. I have the code bellow :
InStr = InStream
size = Integer
BigTextFile = BigText
TempText =Text 1024
...
WHILE NOT InStr.EOS DO BEGIN
size := InStr.READ(TempText, 1024);
BigTextFile.ADDTEXT(TempText);
END;
BigTextFile.WRITE(OutStr);
...
With this code if the file is multiple of 1025, it only process 1024 bytes.
If I put the code bellow :
...
WHILE NOT InStr.EOS DO BEGIN
InStr.READ(TempText, 1024);
BigTextFile.ADDTEXT(TempText);
END;
BigTextFile.WRITE(OutStr);
...
I get the error bellow :
The stream cannot find a zero-terminated string.
The stream may be invalid....
Anybody knows what is the problem??
Thanks in advance!
Regards.
0
Comments
-
I just tried it on nav 2009 r2 and it works correctly;
myfile.OPEN('C:\Temp\TADA.TXT'); myfile.CREATEINSTREAM(InStr); WHILE NOT InStr.EOS DO BEGIN SIZE := InStr.READ(TempText, 1024); //BigTextFile.ADDTEXT(TempText); MESSAGE(TempText); END;
it returned the first 1024 characters then the last digit.
my file was11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
0 -
ara3n wrote:I just tried it on nav 2009 r2 and it works correctly;
myfile.OPEN('C:\Temp\TADA.TXT'); myfile.CREATEINSTREAM(InStr); WHILE NOT InStr.EOS DO BEGIN SIZE := InStr.READ(TempText, 1024); //BigTextFile.ADDTEXT(TempText); MESSAGE(TempText); END;
it returned the first 1024 characters then the last digit.
my file was11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
Hi ara3n,
Thanks for your response, but in my NAV cliente runs wrong. Could you tell me which version of Dynamics NAV R2 do you have?
Thanks in advance.0 -
I used finsql.exe 6.0.320120
-
Yes, I just tested it with 1025 bytes and I can replicate it. It's a bug.
I tested it on RTC and I did get two message boxes in classic I only get one message box.
I suggest to report it to MS.0 -
No, thank you.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