Appends submitted forms to a file of the supplied pathname. This is quite separate from any processing of the form by the application. This can be convient for diagnostics or even serve as a rudimantry form of backup.

Return TypeFunction nameArguments
hzEcodehzHttpEvent::Storeform(const char*,)

Declared in file: hzHttpServer.h
Defined in file : hzHttpServer.cpp

Function Logic:

0:START 1:unknown 2:Return hzerr(E_ARGUMENT,No pathname supplied\n) 3:items 4:unknown 5:Return hzerr(E_OPENFAIL,Could not open file (%s) for writing\n,cpPath) 6:items items items items items 7:unknown 8:unknown 9:items 10:unknown 11:items items 12:Return E_WRITEFAIL 13:items items 14:Return E_OK

Function body:

hzEcode hzHttpEvent::Storeform (const char* cpPath)
{
   //  Appends submitted forms to a file of the supplied pathname. This is quite separate from any processing of the form by the application.
   //  This can be convient for diagnostics or even serve as a rudimantry form of backup.
   //  
   //  Arguments: 1) cpPath Filename to store form submissions
   //  
   //  Returns: E_ARGUMENT If the pathname is not supplied
   //     E_OPENFAIL If the store form file cannot be opened for writing
   //     E_WRITEFAIL If a write error occurs
   //     E_OK  If the form submission was stored
   _hzfunc("hzHttpEvent::Storeform") ;
   static  char cvLine [80];   //  Buffer for time stamp and field id
   std::ofstream   os ;        //  Output file for form submission storage
   hzPair      P ;             //  Field name/value pair
   hzXDate     now ;           //  System time stamp
   uint32_t    nIndex ;        //  Field iterator
   if (!cpPath || !cpPath[0])
       return hzerr(E_ARGUMENT, "No pathname supplied\n") ;
   os.open(cpPath, std::ios::app) ;
   if (os.fail())
       return hzerr(E_OPENFAIL, "Could not open file (%s) for writing\n", cpPath) ;
   now.SysDateTime() ;
   sprintf(cvLine, "@Date: %04d%02d%02d\n", now.Year(), now.Month(), now.Day()) ;
   os << cvLine ;
   sprintf(cvLine, "@Time: %02d%02d%02d\n", now.Hour(), now.Min(), now.Sec()) ;
   os << cvLine ;
   for (nIndex = 0; GetAt(P, nIndex) == E_OK ; nIndex++)
   {
       if (P.name && P.value)
           os << "@" << P.name << ":\t" << P.value << "\n" ;
       if (os.fail())
       {
           os.close() ;
           hzerr(E_WRITEFAIL, "_storeform: Write error on file (%s)\n", cpPath) ;
           return E_WRITEFAIL ;
       }
   }
   os << "@end:\n\n" ;
   os.close() ;
   return E_OK ;
}