character limit for printf, sprintf, fprintf
tony
Am I correct that each string argument for fprintf (and printf, sprintf) is limited to 2399 bytes?
I tried to search the manual and couldn't find any reference to this. I tracked down an "printf error" to fprintf and a long string.
This seems to work:
string s
int i, chars, imax
chars=strlen(s)
imax=1+chars/2000
for(i=0;i<imax;i+=1)
fprintf refnum, "%s", s[2000*i, 2000*i+1999]
endfor
int i, chars, imax
chars=strlen(s)
imax=1+chars/2000
for(i=0;i<imax;i+=1)
fprintf refnum, "%s", s[2000*i, 2000*i+1999]
endfor
Is that a reasonable way to append a string of unknown length to a text file?
If you are just dumping a string to a file like in your example, FBinWrite is a better choice.
July 27, 2020 at 12:20 pm - Permalink
Yes, FBinWrite was sufficient for what I was doing. Still, it might be worth adding a note in the help files about the limitations of these other operations.
July 28, 2020 at 02:28 am - Permalink
I also started a thread about string formatting a while ago at http://info-igor.org/IgorMessages/2019/02/Info-Igor_2019-02_0011.html.
July 28, 2020 at 06:42 am - Permalink