PDA

View Full Version : Little help with line break


FireCat
28/09/2011, 08:03 PM
Does anyone know why isn't this line breaking
Like instead of appearing, in my file, like this:
1,
2,
3,
It appears
1,2,3
Anyone know why?

ew File:example = fopen("Admin/Logs/Labels.txt", io_append);
format(string,sizeof(string),"%f,%f,%f,%s,%i,%i;\n",x,y,z,currenttext,color,currentistele);
fwrite(example,string);
fclose(example);

iggy1
28/09/2011, 08:11 PM
You only use one line break at the end. If you want all values on separate lines put a line break after each value. Unless i misunderstood you.

[L3th4l]
28/09/2011, 08:13 PM
Change "\n" to "\r\n". Honestly, not sure if that's going to work ( I'm not sure what \r means, but that's how I have it, and that's how it works for me :D )

FireCat
28/09/2011, 08:14 PM
;1431778']Change "\n" to "\r\n". Honestly, not sure if that's going to work ( I'm not sure what \r means, but that's how I have it, and that's how it works for me :D )

Lol xD Ok trying it now, I'll edit this post :b

iggy1
28/09/2011, 08:15 PM
;1431778']Change "\n" to "\r\n". Honestly, not sure if that's going to work ( I'm not sure what \r means, but that's how I have it, and that's how it works for me :D )

"\r" is carriage return, it will start the next line aligned to the left i believe, so text on a new line doesn't start in the middle.

EDIT: Just read up "\r". It moves the cursor to the beginning of the current line.

FireCat
28/09/2011, 08:18 PM
You only use one line break at the end. If you want all values on separate lines put a line break after each value. Unless i misunderstood you.

It was an example I gave... :s

[L3th4l]
28/09/2011, 08:19 PM
"\r" is carriage return, it will start the next line aligned to the left i believe, so text on a new line doesn't start in the middle.

EDIT: Just read up "\r". It moves the cursor to the beginning of the current line.
Thanks for this valuable info!

iggy1
28/09/2011, 08:20 PM
It was an example I gave... :s

Yeah i think i misunderstood you, i thought you wanted values on each line :confused: silly me.

FireCat
28/09/2011, 08:22 PM
Yeah i think i misunderstood you, i thought you wanted values on each line :confused: silly me.

No problem :b
Like in my code, it still loads it all correctly but it looks horribly coded in the file.
But it writes for example like this
1.2,3.4,5.9,Hello,4,1;3.7,4.8,3.1,Herro,5,2;
All in the same line, and I would like it to write like this:
1.2,3.4,5.9,Hello,4,1;
3.7,4.8,3.1,Herro,5,2;