curl::option CurlHandle,"FILE","file_name"
Use this option to set the file name of the file where the result will be saved. When you set this option the file is opened and truncated assumed that the program has appropriate privileges. Thus if there was a file with the name the file will be overwrtitten even if the curl::perform function is not called. The file is opened, when the option is set and kept opened so long as the connection is "finished" or another INFILE or FILE option is specified for the connection.
If you donot specify any file to store the downloaded result, then the function curl::perform(CURL) will return the file as a single huge string.
Comment on internals (if you do not understand what I am talking about, most probably you do not need to):
The underlying CURL library requests an opened file handle passed to the library and a function that performs the file writing. The ScriptBasic interface gets the name of the file, opens the file, passes the opened file pointer to the library and specifies the stadard fwrite function to write the file.
The pointer to the function fwrite is taken from the support table, thus is any preloaded module altered this before setting this option the module function will be used.
The file is opened calling the system function fopen via the ScriptBasic support function calling stacks. This means that if some module implements a hook function to control file access that will be taken into account the same way as it is taken into accoung in the case of the BASIC command OPEN.