model_server/gala/dis_gala/inform.cxx
/****************************************************************
* type: 0 - get default user pdf
*       1 - get default user prefs
*       2 - get any local file which name is passed in pszPmodFile
*****************************************************************/
get default user pdf
1 - get default user prefs
2 - get any local file which name is passed in pszPmodFile
get default user pdf 1 - get default user prefs 2 - get any local file which name is passed in pszPmodFile
int download_file_from_pmod( int type, const char *pszServiceName, const char *pszPmodFile, 
                            const char *pszSaveAs, int &checksum  )
{
  int nRet = 0;
  Application *pmod_inform = new Application;
  if( pmod_inform )
  {
    if( !pmod_inform->connect("inform", pszServiceName) && pmod_inform->mySession())
    {
      vstr *file_contents = NULL;
      rcall_inform_get_file( pmod_inform, type, (char *)pszPmodFile, file_contents, checksum );
      if( file_contents )
      {
        FILE *new_file = OSapi_fopen( pszSaveAs, "w" );
        if( new_file )
        {
          int nLen = vstrGetSize( file_contents ); 
          nRet = (OSapi_fwrite((char *)file_contents, sizeof(char), nLen, new_file) == nLen); 
          OSapi_fclose( new_file );
        }
        vstrDestroy( file_contents );
      }
    }
    delete pmod_inform;
  }
  return nRet;
}
int download_file_from_pmod ( int type , const char * pszServiceName , const char * pszPmodFile , const char * pszSaveAs , int & checksum ) { int nRet = 0 ; Application * pmod_inform = new Application ; if ( pmod_inform ) { if ( ! pmod_inform -> connect ( " " , pszServiceName ) && pmod_inform -> mySession ( ) ) { vstr * file_contents = NULL ; rcall_inform_get_file ( pmod_inform , type , ( char * ) pszPmodFile , file_contents , checksum ) ; if ( file_contents ) { FILE * new_file = OSapi_fopen ( pszSaveAs , " " ) ; if ( new_file ) { int nLen = vstrGetSize ( file_contents ) ; nRet = ( OSapi_fwrite ( ( char * ) file_contents , sizeof ( char ) , nLen , new_file ) == nLen ) ; OSapi_fclose ( new_file ) ; } vstrDestroy ( file_contents ) ; } } delete pmod_inform ; } return nRet ; }
type: 0 - get default user pdf
1 - get default user prefs
2 - get any local file which name is passed in pszPmodFile
type : 0 - get default user pdf 1 - get default user prefs 2 - get any local file which name is passed in pszPmodFile