Long string problems 
Author Message
 Long string problems

String problems:

I want to print very long strings to a text file (without wrapping
before the end of the string) - however VFP wraps the lines at 256
characters in the text file. How can I prevent this. (I've tried: SET
MEMO TO 5000 - but this does not help).

m.str=replicate('x',600)
set print to temp.txt
set print on
?m.str
set print off
set print to

Thank you
Mike Farnesi

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Mon, 13 Jan 2003 03:00:00 GMT  
 Long string problems

Try STRTOFILE()


Quote:
> String problems:

> I want to print very long strings to a text file (without wrapping
> before the end of the string) - however VFP wraps the lines at 256
> characters in the text file. How can I prevent this. (I've tried: SET
> MEMO TO 5000 - but this does not help).

> m.str=replicate('x',600)
> set print to temp.txt
> set print on
> ?m.str
> set print off
> set print to

> Thank you
> Mike Farnesi

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 13 Jan 2003 03:00:00 GMT  
 Long string problems
Mike,

Try:

local mfh, mstr
mfh=fcreate('c:\test.txt')
mstr=replicate('x', 1200)
? fputs(mfh, mstr)
mstr=replicate('y', 1200)
? fputs(mfh, mstr)
fclose(mfh)

Hugo


Quote:
> String problems:

> I want to print very long strings to a text file (without wrapping
> before the end of the string) - however VFP wraps the lines at 256
> characters in the text file. How can I prevent this. (I've tried: SET
> MEMO TO 5000 - but this does not help).

> m.str=replicate('x',600)
> set print to temp.txt
> set print on
> ?m.str
> set print off
> set print to

> Thank you
> Mike Farnesi

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 13 Jan 2003 03:00:00 GMT  
 Long string problems

Quote:
> The third response is more correct than the first 2. However I am
> using ? and ? and set memowidth! - but VFP is wrapping at 256 chars in
> the text file - please try this to see for yourself - I must be missing
> something - some setting.

Actually, one of the first two are what you need, otherwise you're banging
your head against a brick wall. From the help itself on SET MEMOWIDTH:

"Note that for ? and ?? the displayed width will not exceed 256 characters."

Why isn't it satisfactory to do:

strtofile(replicate('x',600),'temp.txt')
modi comm temp.txt

Try it. You might like it.



Mon, 13 Jan 2003 03:00:00 GMT  
 Long string problems
Mike,

? and ?? use the SET MEMOWIDTH for wordwrapping long strings. The others
have given you workarounds.
--
df    - (Microsoft FoxPro MVP) http://www.geocities.com/df_FoxPro/


Quote:
> String problems:

> I want to print very long strings to a text file (without wrapping
> before the end of the string) - however VFP wraps the lines at 256
> characters in the text file. How can I prevent this. (I've tried: SET
> MEMO TO 5000 - but this does not help).

> m.str=replicate('x',600)
> set print to temp.txt
> set print on
> ?m.str
> set print off
> set print to



Tue, 14 Jan 2003 03:00:00 GMT  
 Long string problems
The third response is more correct than the first 2. However I am
using ? and ? and set memowidth! - but VFP is wrapping at 256 chars in
the text file - please try this to see for yourself - I must be missing
something - some setting.

Mike Farnesi

Sent via Deja.com http://www.deja.com/
Before you buy.



Tue, 14 Jan 2003 03:00:00 GMT  
 Long string problems
Mike,

There is no solution while using ? and ??, VFP and the printer driver and
the video driver are all going to conspire against you as long as you use
commands designed to output data to the printer/screen.

Just build the string in memory and use strtofile() to send it to the file.

? "Test"
?? "plus more text"

would become:

lcOut = ""
lcOut = lcOut + CRLF + "test"
lcOut = lcOut + "plus more text"

strtofile( lcOut, "thefile.txt" )

strtofile() also supports concatenation to the file, but doing that much
file I/O may slow down the process. VFP can build in memory strings that are
several megabytes long and still have decent performance.
--
df    - (Microsoft FoxPro MVP) http://www.geocities.com/df_FoxPro/


Quote:
> The third response is more correct than the first 2. However I am
> using ? and ? and set memowidth! - but VFP is wrapping at 256 chars in
> the text file - please try this to see for yourself - I must be missing
> something - some setting.



Tue, 14 Jan 2003 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Long, long character string

2. Help: String to Long to fit!

3. STRTRAN() to fix ASCII: Error 1903: String is too long to fit

4. String too long in PICTURE "@M"

5. ?? long strings?

6. string to long error

7. Beware the String Too Long To Fit

8. String for Pass Through command too long

9. Help Anyone (who has experience processing Long Ascii Strings)

10. Long macro command string

11. how long can a string be ?

12. String is too long to fit

 

 
Powered by phpBB® Forum Software