The file access package |
Overview |
| FILE | Read and write access to files (see example) |
| FILEDLG | Call QFileDialog to ask user for filename |
| FILEINFO | Get Info about files (QFileInfo) |
|
DIRINFO |
Get Info about directory structures and their contents (QDirInfo) |
Methods of component File |
|||
| Open | Open a file for reading or writing |
| Close | Close a file |
| Eof | Check if end of file has been reached. |
| read( long ) | read values in ASCII format from file |
| readline | read until end of line has been reached. |
| write | Write values as ASCII text to a file |
| writeline | Write a string with CR to file |
| getbyte | Get a numerical value with 1 byte length from a file |
| getint | Get a numerical value with short length from a file |
| getlong | Get a numerical value with long length from a file |
| getdbl | Get a double value from a file |
| getstr | Get String of special length from file |
| getxstr | get string from file in extended format |
| put | Write binary value to file |
| putstr | Write string to file |
| putxstr | Write string in extended format to file. |
File example |
Public f As file
Public i As Long
Sub button1_clicked()
f.open( "test.dat", "w" )
i = 1
While i < 20 Do
f.write( "Value = "+str(i))
i = i + 1
Wend
f.close()
End Sub
|
Methods of component FileDialog |
The FileDialog component can be used to show an additional dialog where the user can select the name of a file that he wants to use. The following methods may be used with a component of type FileDialog:
| GetOpen |
Print a value of type long (integer or byte) |
| GetSave | Print a value of type double |
| GetDir |
Print s string |
Methods of component FileInfo |
The FileInfo component may be used to gather information about a special file. You first have to create a file component and call the method fileinfo.setFile( filecomp) with this fileinfo component.
| setfile |
Print a value of type long (integer or byte) |
| path |
Print a value of type double |
| basename |
Print s string |
|
filename |
Clear the current window contents |
Methods of component DirInfo |
| setPath |
Set the path of a directory that should be used with the DirInfo component. |
| currentdir | Get the value of the current directory. |
| setcurrent |
Set a new path for the current directory. |
|
GetHome |
Get the home directory for the current user. |