Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combine Two Files 1

Status
Not open for further replies.

BlindPete

Programmer
Jul 5, 2000
711
US
Its been a while but wasn't there a DOS command BCOPY that allowed you to merge to files into one? and then seperate them back out too?

I have automated process that emails small tables. The problem is occasionaly the tables have memos. I'd like to not have the user see both attachments.

Any ideas?
-Pete[noevil]
 
HI

I suggest you to use a variable and combine the memo fields in this case as one variable and save that as body of your email message or save that in a single file and send that as email attachment. If this is not what you are looking, you can be little more specific with your need by adding some code as to what you do now.. so that help can be provided.
:) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Ehhhh no. That won't do it. It is morecomplicated then I made it seem. The tables may have memo and could be many records but the file size is small. Usually much less than 1 MB.

I'm making use of the old DOS copy command

!copy tableX.dbf+tableX.fpt tableX.fpf

This copies the two files (dbf and memo) into one file. Then its attached to email and xmitted. This works fine.

What I can not recall is how to reverse it. I recall it is simple but I just can't remember the syntax! -Pete[noevil]
 
Pete,
Why not just ZIP then up? This will make it easier to separate them, and tables and memo files usually compress pretty good, so the total size will be less. You can use the old "free" DOS PKZIP, the WinZIP command line interface or DYNAZIP to make it all transparent.

Rick
 
Good Idea!

I have pkzip dos version from '91 laying around here somewhere, plus the compression would be habdy too.

Thanks!

-Pete[noevil]
 
You can also get a sharware command line version of WinZip on there site Steve Bowman
steve.bowman@ultraex.com

 
If the contents of both files are just ASCII, you could use FILETOSTR() and STRTOFILE() to concatenate the files, read them back in, and use the AT() function to find the EOF character. Something like this:
[tt]
* Combine the files
cFile1=FILETOSTR("firstfile.txt")
cFile2=FILETOSTR("secondfile.txt")
* Use CHR(0) as EOF indicator (no text file has one)
STRTOFILE(cFile1+CHR(0)+cFile2,"combofile.cmb")

* Now read them back in
cInFile=FILETOSTR("combofile.cmb")
nZeroLoc=AT(CHR(0),cInFile)
cNew1=LEFT(cInFile,nZeroLoc-1)
cNew2=SUBSTR(cInFile,nZeroLoc+1)
[/tt]
I used CHR(0) as the EOF character, but you could easily change this to any character you like, or even a specific string of characters. This could also easily be modified to support an unlimited number of files to put together, but you get the idea.

Ian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top