Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Reading and writing text or binary files – PB Docs 70 – PowerBuilder Library

Reading and writing text or binary files – PB Docs 70

Reading and writing text or binary files

You use PowerScript text file functions to read and write
ASCII text in line mode or stream mode, or to read and write binary
files in stream mode:

  • In line
    mode

    , you can read a file a line at a time until either
    a carriage return or line feed (CR/LF) or the end-of-file
    (EOF) is encountered. When writing to the file after the specified
    string is written, PowerScript appends a CR/LF.
  • In stream mode
    , you can read
    the entire contents of the file, including any CR/LFs.
    When writing to the file, you must write out the specified string (but
    not append a CR/LF).

note.gif Reading a file into a MultiLineEdit You can use stream mode to read an entire file into a MultiLineEdit,
and then write it out after it has been modified.

Understanding the position pointer

When PowerBuilder opens a file, it assigns the file a unique
integer and sets the position pointer for the file to the position
you specify (the beginning or end of the file). You use the integer
to identify the file when you want to read the file, write to it,
or close it. The position pointer defines where the next read or
write will begin. PowerBuilder advances the pointer automatically
after each read or write.

You can also set the position pointer with the FileSeek function.

File functions

These are the built-in PowerScript functions that manipulate
files:

Function Data type returned Action
FileClose Integer Closes the specified file
FileDelete Boolean Deletes the specified file
FileExists Boolean Determines whether the specified file
exists
FileLength Long Obtains the length of the specified file
FileOpen Integer Opens the specified file
FileRead Integer Reads from the specified file
FileSeek Long Seeks to a position in the specified
file
FileWrite Integer Writes to the specified file

For information about using these functions in PowerBuilder
for Unicode, see “Reading and writing files”.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x