Opens the specified file for reading or writing and assigns it a unique integer file number. You use this integer to identify the file when you read, write, or close the file. The optional arguments filemode, fileaccess, filelock, and writemode determine the mode in which the file is opened.
Argument Description
filename A string whose value is the name of the file you want to open. If filename is not on the current directory's relative search path, you must enter the fully qualified name
filemode (optional) A value of the FileMode enumerated type that specifies how the end of a FileRead or FileWrite is determined. Values are:?LineMode! ?(Default) Read or write the file a line at a time?StreamMode! ?Read the file in 32K chunksFor more information, see Usage below
fileaccess
(optional) A value of the FileAccess enumerated type that specifies whether the file is opened for reading or writing. Values are:?Read! ?(Default) Read-only access?Write! ?Write-only accessIf PowerBuilder doesn't find the file, a new file is created if the fileaccess argument is set to Write!
filelock (optional) A value of the FileLock enumerated type specifying whether others have access to the opened file. Values are:?LockReadWrite! ?(Default) Only the user who opened the file has access?LockRead! ?Only the user who opened the file can read it, but everyone has write access?LockWrite! ?Only the user who opened the file can write to it, but everyone has read access?Shared! ?All users have read and write access
writemode (optional) A value of the WriteMode enumerated data type. When fileaccess is Write!, specifies whether existing data in the file is overwritten. Values are:?Append! ?(Default) Write data to the end of the file?Replace! ?Replace all existing data in the fileWritemode is ignored if the fileaccess argument is Read!
Return value
Integer. Returns the file number assigned to filename if it succeeds and -1 if an error occurs. If any argument's value is NULL, FileOpen returns NULL.
Usage
When a file has been opened in line mode, each call to the FileRead function reads until it encounters a carriage return (CR), linefeed (LF), or end-of-file mark (EOF). Each call to FileWrite adds a CR and LF at the end of each string it writes.
When a file has been opened in stream mode, a call to FileRead reads the whole file (until it encounters an EOF) or 32,765 bytes, whichever is less. FileWrite writes a maximum of 32,765 bytes in a single call and does not add CR and LF characters.
File not found If PowerBuilder doesn't find the file, it creates a new file, giving it the specified name, if the fileaccess argument is set to Write!.
用api,可以打开window能打开的所有的文件
ll_rtn = ShellExecuteA (Handle(Parent),'open',文件名称,'','',1)
if ls_open=31 or ls_open=3 then//如果系统找不到打开程序,则弹出打开方式的对话框
Run("rundll32.exe Shell32.dll,OpenAs_RunDLL "+文件名称, Maximized!)
end if