Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Indent a long string into a txt file
Message
 
 
To
02/05/2022 09:40:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01684311
Message ID:
01684317
Views:
32
>>>>Hi,
>>>>
>>>>The code writes a long string (it could be up to 200 or more characters) into a .txt file. The string is written to the .txt file using strtofile() function. I would like the long string to be indented by, say 10 characters. I can indent the first line, by adding a space(10). But the rest of the string go to the 1st column,
>>>>Is there a way to do it, other than parsing the string into 60-70 characters and adding a space(10) before each line?
>>>>
>>>>TIA
>>>
>>>Not tested, but something like this may work:
>>>
>>>Set Margin to 10
>>>Set Printer to File lcYourFileName
>>>List Memory Like lcYourString to Printer Noconsole
>>>To set the length of each line, you can try Set Memowidth.
>>>
>>>If this doesn't work, you can try to redirect the string to a file using ?, and set the "not for new design" values of _WRAP, _RMARGIN and _LMARGIN.
>>
>>Thank you. I will try your approach. Although what is confusing, to me, is that you use TO PRINTER and I need to save the text using STRTOFILE().
>
>If you must use Strtofile(), you are on your own, I think. My solution is to "print" to a file, the net result will still be a file.

Ok. Thanks.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform