Page 1 of 1

Write#, Print#, Input#, LineInput#

PostPosted: Sat Jun 18, 2011 11:32 pm
by Henning
Hi,

Seems that Write #ff, String(THIp[i]) is not implemented, or? Cant find anything in doc-files.

FreeFile() IS there, (only that the first call returns 256!?), then I think file I/O should also work...
Open "C:/IP_Settings.inc" For Output Access ReadWrite As ff compiles without error.

/Henning

Re: Write#, Print#, Input#, LineInput#

PostPosted: Sun Jun 19, 2011 7:00 am
by Slowdown
Henning,

i'm playing with readstring, readcstring, writestring, ect. ect.
also tried,
Code: Select all
'  ff = FreeFile
  Open DirFilePath For Input Access Read As #ff ' open file for reading
  Do While Not EOF(ff) ' test for end of file
    Line Input #ff, MyStr ' get the data from file
    MsgBox(MyStr)
  Loop
  Close #ff ' close file

indeed no error's but it isn't working (yet)
didn't report it because of viewtopic.php?f=1&t=88
you did adressed the problem here.

Re: Write#, Print#, Input#, LineInput#

PostPosted: Sun Jun 19, 2011 9:53 am
by Henning
Hi,

Yes I know ;) but that was in march... this was just a little pop-up...

When running my app, I Read/Write som 60 rows from/to a Setup-file. Thats why I also need errorhandling, the first time there is no Setup-file.

WriteString can only write one (1) string to a file, from what I've seen. If I WriteString in a loop, the resulting file only holds the last string.

Anyway, there has been a huge progress in Q7B :)

/Henning

Re: Write#, Print#, Input#, LineInput#

PostPosted: Sun Jun 19, 2011 1:13 pm
by Slowdown
Hi,
Can you perhaps use Readlist and writelist

Q7Basic's Language Reference

ReadList

Function ReadList(FilePathOrURL As String) As List
ReadList(...) loads an entire file from a path or on a website into an Array.

WriteList

Function WriteList(Argument As List, FilePathOrURL As String) As Boolean
WriteList(...) saves the entire List in a file to a given path.

This is how i solve my problem.
Anyway, there has been a huge progress in Q7B

There is indeed a huge progress and even if i think what the next release will bring us :o
for example code completion and a lot of bugs are no more there 8-)

Re: Write#, Print#, Input#, LineInput#

PostPosted: Sun Jun 19, 2011 3:08 pm
by Henning
Thx, will try that.

/Henning

Re: Write#, Print#, Input#, LineInput#

PostPosted: Tue Jun 21, 2011 10:01 am
by berndnoetscher
Henning wrote:Thx, will try that.

/Henning


Some of those old basic file functions are not implemented yet.

It is really tricky to support them.

I would use ReadString() together with Split() to read or write string files (line by line).
More better is to use ReadList and co.

Re: Write#, Print#, Input#, LineInput#

PostPosted: Tue Jun 21, 2011 10:47 am
by Henning
Hi,

No problem anymore :)

I build a List and use WriteList. ReadList and access by index.

/Henning

Re: Write#, Print#, Input#, LineInput#

PostPosted: Tue Jun 21, 2011 7:35 pm
by Slowdown
you are welcome ;)