views:

11

answers:

2

Dear reader,

I tried all options to create a new line in my output file, but still I get a txt-file with everything behind the previous information. Even with this supersimple code:

globals [file]

to setup clear-all

set file "results\GA1.txt" if is-string? file [while [file-exists? file] [set file replace-item (length file - 5) file "11" ] file-open file] end

to go tick write-to-file end

to write-to-file file-print (word ticks) FILE-TYPE "\n" file-write 1 file-print (word " " 2 ";") file-write 1 file-print (word " " 2 ";")
file-print "" ;; blank line end

I do not get blank lines or line breaks. I work in Netlogo 4.1. Does anybody know what could be the problem?

Thank you for your help.

Netlogo-user

A: 

You forgot to close the file with file-close or to force it to write data to disk with a file-flush.

When you do a file-write the data does not get written to disk immediately. It gets placed in a buffer. When the buffer is large enough the data is written to disk. You can force netlogo to write data to a file by using the file-flush or file-close commands.

Jose M Vidal
A: 

answered here: http://groups.yahoo.com/group/netlogo-users/message/11103

Seth Tisue