PDA

View Full Version : read from file



haytham
08-06-2014, 09:54 AM
Hi

I was trying to work with some files. I checked the documentation and I see the function to open and write to files, but I see no function to read from a file.

Is it possible to read from a file and if so can someone point me to the documentation of the function?

thank you

Hassan-HS
08-06-2014, 11:11 AM
Dear Hytham,


I've fixed the documentation, And this is a sample for reading / writing from a file.



Public Sub main()

' Open or Create File and write Data , finally Close it

Dim fileName
Dim fileMode
fileMode = FILE_APPEND
fileName = "C:\VertexWorld.txt"
OpenFile fileName, CInt(fileMode)
FileWrite "Welcome TO VertexFx World"
CloseFile
msgbox GetEntry (Cstr(fileName),1)

End Sub

haytham
08-06-2014, 11:46 AM
isn't that an example of writing to the file? I don't see where you read from the file...

thank you

Hassan-HS
08-06-2014, 12:12 PM
Hello,

To write...


Dim fileName
Dim fileMode
fileMode = FILE_APPEND
fileName = "C:\VertexWorld.txt"
OpenFile fileName, CInt(fileMode)
FileWrite "Welcome TO VertexFx World"
CloseFile


To read...




Dim fileName
fileName = "C:\VertexWorld.txt"
msgbox GetEntry (Cstr(fileName),1)
'1 means the number of line