Source language: Translate to:

Is it possible to write a consecutive, line of characters?

NeoBook tips, tricks, code samples and more...

Moderator: Neosoft Support

Is it possible to write a consecutive, line of characters?

Postby Jim Brammer » Thu Feb 07, 2002 4:26 pm

Is it possible to write a consecutive line of characters?

I need to write a line to a file like so:

ab,ac,34,fe,21,g4

The only thing I can see to do with FileWrite is either choose the specific line I want to write to (which if kept the same) is writes over itself), or to append, which then lists then like so:

ab,
ac,
34,
fe,
21,
g4

Am I missing a way to do this (easily)?

Thanks,
Troy


--------------------------------------------------------------------------------


Hy Troy,

the most easy way is to create your line inside one variable. If the line is ready, just write the variable to a file and all works fine.

something like

setvar "[line]" "[line],[newentry]"

repeat this, until your line is complete .... than

FileWrite "testfile" "Append" "[line]"

Rgds

Gerhard


--------------------------------------------------------------------------------


Hy Troy,

maybe it is not my day ...... but I did not get the point ... 8-(

I just tried out a little sample in NB and it works fine ...

Structures like

FileWrite "test.txt" "1" "[tmp1],[tmp2],[tmp3],[tmp4]"

are allowed and allow also a char-separated single-line output

You also can modify a special line inside a text file, eg. adding a char-separated text at the end of the line ...

FileRead "test.txt" "1" "[tmp]"
FileWrite "test.txt" "1" "[tmp],[text]"

adds to line 1 the text, contained in variable [text], separated by ","

Rgds

Gerhard
Jim Brammer
 

Return to NeoBook Knowledgebase

Who is online

Users browsing this forum: Danito and 1 guest

cron