| View previous topic :: View next topic |
| Author |
Message |
attreus Valued Newbie

Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Fri Feb 24, 2006 2:57 am Post subject: list savefile-question |
|
|
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 |
|
 |
WidgetCoder Contributor


Joined: 28 May 2002 Posts: 126 Location: CO, USA
|
Posted: Fri Feb 24, 2006 3:20 am Post subject: |
|
|
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 |
|
 |
attreus Valued Newbie

Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Fri Feb 24, 2006 3:49 am Post subject: |
|
|
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 |
|
 |
WidgetCoder Contributor


Joined: 28 May 2002 Posts: 126 Location: CO, USA
|
Posted: Fri Feb 24, 2006 4:13 am Post subject: |
|
|
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 |
|
 |
attreus Valued Newbie

Joined: 30 Jul 2002 Posts: 46 Location: Berlin/Germany
|
Posted: Fri Feb 24, 2006 12:58 pm Post subject: |
|
|
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 |
|
 |
|