Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - neterror() return the last network error code http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 neterror()          Return the last network error code
------------------------------------------------------------------------------
 Declaration
   database.hdr

 Syntax
   func uint neterror extern

 Arguments
   None.

 Return
   Network error code.

 Description
   The neterror() function returns the last network error code. The error
   code returned is the DOS extended error code.

   Use neterror() to obtain information as to why a file did not open.

 Example
   #define EXAMPLE_DATABASE
   #include example.hdr

   func logical NetOpen
   param const char cFile, alias sDbf, value int nTimes
   // Attempt opening database on a network
   vardef
      logical lOpened
   enddef
   lOpened := .f.
   do while nTimes > 0                     // opening loop
      open cFile alias sDbf                // open database
      if neterror() == 0                   // if there was no network error
         lOpened := .t.                    // set success flag
         exit                              // exit trial loop
      else                                 // if error ocuurred
         nTimes--                          // decrement attempt counter
         delay( 1 )                        // wait
      endif
   enddo
   return( lOpened )
   endproc
   
   proc Test_neterror
   if NetOpen( "stest.dbf", sTest, 5 )     // tries to open five times
      ? "database opened"
   else
      ? "database could not be opened"
   endif
   endproc

   proc main
   Test_neterror()
   endproc

See Also: on neterr do

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson