PDA

View Full Version : fprint not accepting "\n" new line character


chayanvinayak
10-09-2007, 01:48 AM
hi,

i am writing xyz position of a particle for each frame(1-100) in text file and i am writing "new line" character after every frame so xyz values goes to new line.
but when it writes values to file, "\n" is neglected.

code ----------------------------------------
for($i=$initial_frame;$i<=$final_frame;$i++){// ------- this loop is for reading info
of one particle in all frames
currentTime $i;
float $temp[] = `getParticleAttr -at position particleShape1.pt[$n]`;
string $one_particle_one_frames = $temp[0]+" "+$temp[1]+" "+$temp[2]+"\n";
$one_particle_all_frames[$n] =$one_particle_all_frames[$n] + $one_particle_one_frames;
}
fprint $fileid $one_particle_all_frames[$n];


/----------------------------------------------------
but when it writes, all the values come in same line


kindly suggest
Thanks

r4inm4ker
10-09-2007, 03:53 AM
hi,


for($i=$initial_frame;$i<=$final_frame;$i++){// ------- this loop is for reading info
of one particle in all frames
currentTime $i;
float $temp[] = `getParticleAttr -at position particleShape1.pt[$n]`;
string $one_particle_one_frames = $temp[0]+" "+$temp[1]+" "+$temp[2]+"\n";
$one_particle_all_frames[$n] =$one_particle_all_frames[$n] + $one_particle_one_frames;
}
fprint $fileid $one_particle_all_frames[$n];


/----------------------------------------------------


i did some testing on simple fprint with '\n' and didn't find any problem.
may be u messed up by double initializing $i

azshall
10-09-2007, 11:36 PM
Try using \r\n instead of just \n

CGTalk Moderation
10-09-2007, 11:36 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.