Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating and saving multiple texts
Message
From
23/05/2010 18:09:35
 
 
To
23/05/2010 18:01:27
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01465655
Message ID:
01465659
Views:
36
that did it!!! thanks hilmar.
k

>For text files, better use the combination chr(13) + chr(10). I suggest you #DEFINE it somewhere, preferably in an #INCLUDE file. Your #DEFINE might look like this
>
>#DEFINE NEWLINE chr(13) + chr(10)
>
>Then:
>
>lcMyText = "Line 1" + NEWLINE + "Line 2"
>
>>tnx hilmar.
>>I seem to lose my chr(13) formatting in the filetostr (that's my added text between the text file) - although the formatting of the actual text files remains in tact.
>>
>>k
>>
>>>Several options. One of the simplest is the converse of FileToStr(), namely, StrToFile(). It will save the specified expression (e.g., etext0 + etext1 + etext2) to disk. Nor do you have to save it all at once; there is an "append" option that allows you to add to the end of an existing file.
>>>
>>>Another option is low-level file functions. Probably more efficient if you want to add several pieces to a file, but it requires more commands. I suggest you start with StrToFile(), due to its simplicity.
>>>
>>>>combining text files into one composite text file is not a problem - below seems to work.
>>>>However i am having difficulty saving the result - maybe i'm standing too close and missing the obvious.
>>>>i would like to save etext2 in c:/mydirectory as a new text3.txt
>>>>any suggestions will be appreciated:
>>>>
>>>>etext0=FILETOSTR("c:\mytext\words1.txt")
>>>>etext1=FILETOSTR('c:\mytext\words2.txt')
>>>>etext2="Words of etext0"+CHR(13)+etext1+CHR(13)+"_______________________"+CHR(13)+"words of etext2:"+CHR(13)+etext1 
>>>>
>>>>
>>>>thanks
>>>>k
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform