The File JavaScript class. Open, close, read, write, get information about files.
More...
The File JavaScript class. Open, close, read, write, get information about files.
var file =
new File( filePath );
if ( file.exists )
{
var message = "The output file \"" + file.name + "\" exists. Do you wish to overwrite it?"
return false;
}
return true;
◆ File()
File::File |
( |
String & |
filename | ) |
|
- Parameters
-
filename | : The path to the file. |
◆ close
◆ open
void File::open |
( |
int |
accessMode | ) |
|
|
slot |
Open the file with specific access mode.
- Parameters
-
accessMode | : The specified access mode. The possible access modes are w (write), r (read) and x (execute). |
◆ read
Read all the file.
- Returns
- Returns the entire file.
◆ readByte
Read the next char of the file.
- Returns
- Returns the next char of the file.
◆ readLine
String File::readLine |
( |
| ) |
|
|
slot |
Read one line of the file.
- Returns
- Returns the next line of the file.
◆ readLines
StringList File::readLines |
( |
| ) |
|
|
slot |
Read each line of the file.
- Returns
- Returns a list of strings each storing one line of the file.
◆ remove
◆ write
void File::write |
( |
String & |
data, |
|
|
int |
length = -1 |
|
) |
| |
|
slot |
Write a string in the file.
- Parameters
-
data | : The data to be written to the file. |
length | : The length of the data to be written. |
◆ writeByte
void File::writeByte |
( |
int |
byte | ) |
|
|
slot |
Write a char in the file.
- Parameters
-
byte | : The char to write to the file. |
◆ writeLine
void File::writeLine |
( |
String & |
data | ) |
|
|
inlineslot |
Write a string in the file and go next line.
- Parameters
-
data | : The data to be written to the file. |
◆ baseName
◆ created
Date when the file was created.
◆ eof
◆ executable
◆ exists
◆ extension
◆ fullName
◆ hidden
◆ lastModified
QDateTime File::lastModified |
|
read |
Date when the file was modified.
◆ lastRead
Date when the file was read.
◆ name
◆ path
◆ readable
◆ size
◆ symLink
◆ writable