Return Values for Status

Parent Previous Next



var fileResult = TW.readFile("path/to/file.txt");


       var status = TW.writeFile("path/to/file.txt","blah blah");

For TW.readFile(   the return value res is an object (a map) with three member properties, here we look at the property 'status'



For TW.writeFile(   the status value is returned directly as an integer.



There are three return integer values, in QtScript test for them as numerical integers:

        SystemAccess_OK = 0,
       SystemAccess_Failed = 1,
       SystemAccess_PermissionDenied = 2

SystemAccess_PermissionDenied is returned when writing is disabled.

If it is enabled, though, and writing fails, there is no further distinction (e.g.,
whether you are trying to write to a folder that doesn't exist, or to a
file that is protected by some system's permissions, etc.)

These may be expressed retrieved as a global as in pan_Tw.mod

 const twConst = {

                            SystemAccess_OK : 0,

                        SystemAccess_Failed : 1,

       SystemAccess_PermissionDenied : 2

             }; // end twConst

Reference: Stefan Löffler

Created with the Personal Edition of HelpNDoc: Easy to use tool to create HTML Help files and Help web sites