| Return Type | Function name | Arguments |
|---|---|---|
| hzEcode | OpenInputStrm | (ifstream&,const char*,) |
Declared in file: hzDirectory.h
Defined in file : hzDirectory.cpp
Function Logic:
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 ;
}