Little help with line break
#1

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?
pawn Код:
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);
Reply
#2

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.
Reply
#3

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 )
Reply
#4

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
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 )
Lol xD Ok trying it now, I'll edit this post :b
Reply
#5

Quote:
Originally Posted by [L3th4l]
Посмотреть сообщение
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 )
"\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.
Reply
#6

Quote:
Originally Posted by iggy1
Посмотреть сообщение
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...
Reply
#7

Quote:
Originally Posted by iggy1
Посмотреть сообщение
"\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!
Reply
#8

Quote:
Originally Posted by FireCat
Посмотреть сообщение
It was an example I gave...
Yeah i think i misunderstood you, i thought you wanted values on each line silly me.
Reply
#9

Quote:
Originally Posted by iggy1
Посмотреть сообщение
Yeah i think i misunderstood you, i thought you wanted values on each line 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;
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)