Opens or creates a file with the specified filename and returns a handle to the opened file.
If the file name includes a directory name, the file is opened in the specified directory. Otherwise, Silk Performer searches for the file in the directory where the test script is located, in the data directory, in the results directory and in the project directory.
If you are going to use remote agents for the load test, you should store your data files in the Data directory or in the directory where the test script is located. Note that in any case you have to add the data files to your load-testing project.
Kernel.bdh
FOpen( out hFile : number, in sFileName : string, in nAccessMode : number optional, in nOpenMode : number optional, in nShareMode : number optional ):boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
hFile | Variable receiving the file handle. |
sFileName | Name of the file. |
nAccessMode |
Access options (optional). Possible values are:
|
nOpenMode |
Specifies whether to create or open the file (optional). Possible values are:
|
nShareMode |
Share options (optional). Possible values are:
|
dcltrans transaction TMain var hFile : number; sOutput : string; begin // create new file FOpen(hFile, "c:\\temp\\dummyfile.txt", OPT_FILE_ACCESS_READWRITE, OPT_FILE_CREATE); write("new file created"); writeln; // write string to file sOutput := "Hello world!"; FWrite(hFile, sOutput); write("string written to file"); writeln; // close file FClose(hFile); write("file closed"); writeln; end TMain;
new file created string written to file file closed
WebFileUpload01.bdf