forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


list savefile-question

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
attreus
Valued Newbie


Joined: 30 Jul 2002
Posts: 46
Location: Berlin/Germany

PostPosted: Fri Feb 24, 2006 2:57 am    Post subject: list savefile-question Reply with quote

hi,

i want to save text written in a multiline-edit.
what i'm doing is assign it to a list and then save it to a file.
but after saving there is always one linebreak at the end of the file even if i specifically remove it before saving.
so if my text contains only one character, the saved file is 3 bytes because of the linebreak.
is there a way to remove the linebreak?

thanks

attreus
Back to top
View user's profile Send private message
WidgetCoder
Contributor
Contributor


Joined: 28 May 2002
Posts: 126
Location: CO, USA

PostPosted: Fri Feb 24, 2006 3:20 am    Post subject: Reply with quote

Multi line edit boxes use two additional characters per line Carriage return "@CR() or @chr(13)" and Line feed "@LF() or @chr(10)". The @TRIM(<string>) will remove the superfluous ending characters.

Last edited by WidgetCoder on Fri Feb 24, 2006 4:24 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
attreus
Valued Newbie


Joined: 30 Jul 2002
Posts: 46
Location: Berlin/Germany

PostPosted: Fri Feb 24, 2006 3:49 am    Post subject: Reply with quote

thanks widgetcoder, but i did try this before.
@trim() doesn't work, my 1byte text is still 3bytes as file.
now i tried to save as binfile, this works and the filesize is 1byte but if i open it again with
Code:
list loadfile,1, ...
and
Code:
dialog set,e1,@text(1)
the cr and lf characters are there again.
no idea if it's from the the edit-control or does the list make an empty line.
i hope you can understand what i mean.
Back to top
View user's profile Send private message
WidgetCoder
Contributor
Contributor


Joined: 28 May 2002
Posts: 126
Location: CO, USA

PostPosted: Fri Feb 24, 2006 4:13 am    Post subject: Reply with quote

try:
Code:
dialog set,e1,@trim(@text(1))


Since the values you're saving are so small you might consider using an inifile or the registry.
Back to top
View user's profile Send private message Send e-mail
attreus
Valued Newbie


Joined: 30 Jul 2002
Posts: 46
Location: Berlin/Germany

PostPosted: Fri Feb 24, 2006 12:58 pm    Post subject: Reply with quote

thank you, life can be so simple, works great.

the 1byte-file was only an example. normaly the files are much bigger.
but it is nessesary to get out the correct filesize.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group