File CLOSE without 0D0A (truncate file)

Asallai
Member Posts: 142
Hi All,
I've searched this, but I did not find any solution.
So my problem is at the Close a file (Text).
I have to generate a file for a program, but when I close my file, the file.CLOSE procedure is put a 0D0A
of the end of file automatically. :shock:
Can I avoid this? :?: How can I truncate this last 2 bit when I close a file?
Thank you.
Andras
I've searched this, but I did not find any solution.
So my problem is at the Close a file (Text).
I have to generate a file for a program, but when I close my file, the file.CLOSE procedure is put a 0D0A
of the end of file automatically. :shock:
Can I avoid this? :?: How can I truncate this last 2 bit when I close a file?
Thank you.
Andras
0
Comments
-
Try this:
Just before closing the file, change the mode to binary and close the file.
I didn't try it out though.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Try this (not tested by me, but should work)
file.textmode(true);
file.create('Blubber.txt');
file.write('DoThis');//This add's 0D0A on the end
file.write('DoThat');//This add's 0D0A on the end
file.seek(file.len-2);//This sets the pointer 2 bytes back
file.trunc;//This cuts the file on the actual pointer
file.close; //This closes the file w/o adding more Data to it.0 -
rthsw wrote:Try this (not tested by me, but should work)
file.textmode(true);
file.create('Blubber.txt');
file.write('DoThis');//This add's 0D0A on the end
file.write('DoThat');//This add's 0D0A on the end
file.seek(file.len-2);//This sets the pointer 2 bytes back
file.trunc;//This cuts the file on the actual pointer
file.close; //This closes the file w/o adding more Data to it.
Yes, I tried this method but maybe I did something wrong, because the 0D0A is still there :-o
But I tried thisfileData_Out.CLOSE; fileData_Out.OPEN(tFullFileName); fileData_Out.SEEK(fileData_Out.LEN-2); fileData_Out.TRUNC; fileData_Out.CLOSE;
It is "stupid" I think, but it is works :-o
I think rthsw that your code is OK!
Thank you to all![/b]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