Return TypeFunction nameArguments
hzEcodeOpenInputStrm(ifstream&,const char*,)

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

Function Logic:

0:START 1:!filepath||!filepath[0] 2:Return hzerr(E_ARGUMENT,No input filename specified) 3:lstat(filepath,&fs)<0 4:Return hzerr(E_NOTFOUND,Filename %s does not exist,filepath) 5:!S_ISREG(fs.st_mode) 6:Return hzerr(E_TYPE,Filename %s is not a file,filepath) 7:!fs.st_size 8:Return hzerr(E_NODATA,Filename %s is empty,filepath) 9:input.is_open() 10:hzwarn 11:open ifstream::fail 12:input.fail() 13:Return hzerr(E_OPENFAIL,Filename %s could not be opened,filepath) 14:Return E_OK

Function body:

hzEcode OpenInputStrm (ifstream& input, const char* filepath)
{
   _hzfunc(__func__) ;
   FSTAT   fs ;
   if (!filepath || !filepath[0])
       return hzerr(E_ARGUMENT, "No input filename specified") ;
   if (lstat(filepath, &fs) < 0)
       return hzerr(E_NOTFOUND, "Filename %s does not exist", filepath) ;
   if (!S_ISREG(fs.st_mode))
       return hzerr(E_TYPE, "Filename %s is not a file", filepath) ;
   if (!fs.st_size)
       return hzerr(E_NODATA, "Filename %s is empty", filepath) ;
   if (input.is_open())
       hzwarn(E_DUPLICATE, "Filename %s is already open", filepath) ;
   else
   {
       input.open(filepath) ;
       if (input.fail())
           return hzerr(E_OPENFAIL, "Filename %s could not be opened", filepath) ;
   }
   return E_OK ;
}