3 registered members (TedMar, Ayumi, kzhao),
1,359
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Adding a new line to a txt file
#353281
01/09/11 01:11
01/09/11 01:11
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
Hey friends, I am just playing around with some txt - ftp stuff and want to create a list of files hat need to be downloaded. I want the list to be like this url to first thing url to second thing etc. I know txt_load put every line in a seperate string, no problem. I just can't get it to work to enter a new line with \n. I enter two entrys, at the end of the string who is written stands a \n but If I open the txt file they aren't in two lines, it is just one long line. Who can I do this? I don't want to open the notepad, press end and then enter as this isn't beautiful
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: Adding a new line to a txt file
[Re: Liamissimo]
#353283
01/09/11 01:33
01/09/11 01:33
|
Joined: Jun 2008
Posts: 428
Rasch
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 428
|
Try to use .rtf instead of .txt I also had problems with it. Otherwise this is some code i have used to write into .rtf files.
STRING* url_text = "";
str_cpy(url_text, "http://www.3dgamestudio.de/\n";
var filehandle = file_open_append ("url.txt"); // better use "url.rtf"
file_str_write(filehandle,url_text);
file_close (filehandle)
|
|
|
Re: Adding a new line to a txt file
[Re: Rasch]
#353285
01/09/11 01:44
01/09/11 01:44
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
Good Idea, tried it but rtf is even stranger, the file gets bigger and bigger but shows nothing, just If i open it with Editor it shows my entrys, not useable like this =/
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: Adding a new line to a txt file
[Re: Rasch]
#353287
01/09/11 01:48
01/09/11 01:48
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
I want to write and read it and then upload it to the FTP. Everythings fine, except for the strange idea to enter a new line in a text file Just to see, this is what I am using
var filehandle = file_open_append("liam_new.txt"); ///LIAM VERSION!!! LIAM LÄDT AUF IMAD!!!
str_cat(ftpurl,"\n");
file_str_write(filehandle,ftpurl);
file_close(filehandle);
Last edited by TheLiam; 01/09/11 01:52.
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: Adding a new line to a txt file
[Re: Liamissimo]
#353288
01/09/11 01:53
01/09/11 01:53
|
Joined: Jun 2008
Posts: 428
Rasch
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 428
|
maybe some code would give more ideas edit: alright. As i said i had these problems too with txt files. What exactly is not working with the .rtf files?
Last edited by Rasch; 01/09/11 01:54.
|
|
|
Re: Adding a new line to a txt file
[Re: Rasch]
#353289
01/09/11 01:53
01/09/11 01:53
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
Imagine you the exmaple above two times, should enter a new line after each text, doesn't in fact.
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
Re: Adding a new line to a txt file
[Re: Liamissimo]
#353291
01/09/11 02:04
01/09/11 02:04
|
Joined: Dec 2008
Posts: 528 Wagga, Australia
the_mehmaster
User
|
User
Joined: Dec 2008
Posts: 528
Wagga, Australia
|
What about a carriage return or line-feed? have you tried either or both? EDIT: just found out windows notepad uses 'Carriage return,Line-feed' sequence for a new line , look 'em up in an ascii table somewhere. That should be what your looking for.. Use all three characters(CR-LF-Newline), then it should work everywhere
Last edited by the_mehmaster; 01/09/11 02:11.
|
|
|
Re: Adding a new line to a txt file
[Re: GorNaKosh]
#353311
01/09/11 10:46
01/09/11 10:46
|
Joined: Jul 2009
Posts: 1,198 Berlin, Germany
Liamissimo
OP
Serious User
|
OP
Serious User
Joined: Jul 2009
Posts: 1,198
Berlin, Germany
|
I.am.happy. Works fine, thank you! I would never have found a thing like this
"Ich weiss nicht genau, was Sie vorhaben, aber Sie können keine Triggerzonen durch Ihr Level kullern lassen." -JCL, 2011
|
|
|
|