Merge two textfiles?

Storm
Member Posts: 27
Hi
I want to merge two textfiles via. Navision and have done it so far by writing a SHELL command:
When the two files are merged it also seems that a (It looks like an arrow pointing right in a binary texteditor) appears at the end of the new file. Why is that? and how do you get rid of it?
Have tried:
Thanks
/H.
I want to merge two textfiles via. Navision and have done it so far by writing a SHELL command:
SHELL('cmd','/C','copy '+File1+'+'+File2 +' '+NewFile);Can't you do this without using the SHELL command?
When the two files are merged it also seems that a (It looks like an arrow pointing right in a binary texteditor) appears at the end of the new file. Why is that? and how do you get rid of it?
Have tried:
FileVar.OPEN(NewFile); FileVar.SEEK(FileVar.LEN-1); FileVar.TRUNC;Can someone help me?
Thanks
/H.
0
Comments
-
It looks like you've got the right idea. You may have to open up the file in binary mode rather than text mode. Try this :
FileID.WRITEMODE(TRUE);
FileID.TEXTMODE(FALSE);
FileID.OPEN(FullExportFilename);
FileID.SEEK(FileID.LEN-1);
FileID.TRUNC;
FileID.CLOSE;0 -
For the copying you could do:
1) copy the file first file to the new file with FILE.COPY
2) open the new file with a FILE variable
3) open the second file with a FILE variable
4) read the lines of the second file and write them to the new file
I think if the strange character was there in the input files only then it will occur in the output (new) file? Are the files text only?
Grtz.
Remco0 -
Try :
SHELL('cmd','/C','copy '+File1+' /B +'+File2 +' /B '+NewFile + ' /B');
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Hey again
Thanks for your replies.
I've at long last solved it...
I had to use the SHELL command but the reason why I couldn't get the TRUNC function to work was simply because the system couldn't copy the files fast enough before executing the rest of the code, so I had to put in a SLEEP right after the SHELL command... it took me pretty long time to figure that out :-)
Thanks again0 -
An IF SHELL - THEN is a better idea.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