I Have a C Program as follow. I don't what to use stat64 instead of stat in both Solaris & HP-AIX. I want to build this Program this on both Solaris & HP-AIX.
#include "zunx.h"
#include <nls.h>
/*
* NAME: zunx_file_exists
*
* PURPOSE: Checks if a file exists.
*
* INVOCATION: boolean zunx_file_exists(name)
* char *name;
*
* INPUTS: name - file to check
*
* OUTPUTS: TRUE or FALSE
*
* DESCRIPTION: zunx_file_exists does a stat on the specified file,
* and returns TRUE if a stat is found. No check is
* made to determine what type of file it is.
*/
boolean zunx_file_exists
(const char *buf)
{
#if defined(UNIX)
struct stat fstat;
if (buf != NULL && stat(I2E1(buf), &fstat) == 0)
return TRUE;
else
return FALSE;
#endif
#ifdef NT_OS
struct _stat64 fstat;
if (buf != NULL && _stat64((char *) I2E1(buf), &fstat) == 0)
return TRUE;
else
return FALSE;
#endif
}
I came across a macro in Solaris like :
#ifdef UNIX
#define _FILE_OFFSET_BITS 64
#endif
is this definition is correct for above program?
for HP-AIX its use _LARGE_FILES
macro.
but I don't know how to define this macro in above program in order to run successfully on both OS.
Please suggest some ideas.