printing large strings
cody wrote on Jul 06, 2008
I have an iraf script which I'm using to output a lot of photometric data from an array. My preferred format for the output involves many columns (one for each array value) and a number of rows representing data from different nights. I have been storing the output for each night as string, by progressively concatenating each array value onto it until the end of the array is reached. Then I print the entire line to the output file with >> and move on to the array for the following night. I would like to make these arrays very large now, but it appears that there is a limit to the length of strings, given by string.p_length=1023. Hence for a large enough array I cannot print all the values to separate columns in the same row of the output file; it gets cut off. So my questions are:
-Is p_length fixed by the system, or can I change it somehow?
-Presumably there is a better way to output data into columns without forcing a new line - what might that be (I can't seem to find much info on formatted output)? Thanks!
-Ann Marie
-Is p_length fixed by the system, or can I change it somehow?
-Presumably there is a better way to output data into columns without forcing a new line - what might that be (I can't seem to find much info on formatted output)? Thanks!
-Ann Marie
Mike Fitzpatrick wrote on Jul 06, 2008
The max size of a string that can be output by the print() command is currently SZ_LINE (i.e. 1023 chars). Note that print() includes a newline by default, however a printf() statement can be used to output small chunks of the file as you please so long as you output the newline yourself when ready (see 'help printf' for more info).
-Mike
-Mike
cody wrote on Jul 06, 2008
Aha, using printf to output the data one bit at a time works great! Thanks!!
Last post on Jul 06, 2008