Пример #1
0
/*--------------------------------------------------------------------------*/
void C2F(getfileinfo)(int *fd, FILE *fa, int *swap2, int *type, int *mode, char *filename, int *lf, int *ierr)
{
	char *filenamefromfd = NULL;
	if (*fd<0 || *fd>=GetMaximumFileOpenedInScilab() ) 
	{
		*ierr=1;
		return;
	}
	if ( GetFileTypeOpenedInScilab(*fd) == 0 ) 
	{
		*ierr=2;
		return;
	}
	fa = GetFileOpenedInScilab(*fd);

	*swap2 = GetSwapStatus(*fd);
	*type = GetFileTypeOpenedInScilab(*fd);
	*mode = GetFileModeOpenedInScilab(*fd);
	filenamefromfd = GetFileNameOpenedInScilab(*fd);
	if (filenamefromfd) strcpy(filename,GetFileNameOpenedInScilab(*fd));
	else strcpy(filename,"");

	*lf=(int)strlen(filename);
	*ierr=0;
}
Пример #2
0
/*--------------------------------------------------------------------------*/
void C2F(mtell) (int *fd, double *offset, int *err)
{     
	FILE *fa= GetFileOpenedInScilab(*fd);
	if ( fa == (FILE *) 0 ) 
	{
		char *filename = GetFileNameOpenedInScilab(*fd);
		if (filename)
		{
			sciprint(_("%s: Error while opening, reading or writing '%s'.\n"),"mtell",filename);
		}
		else
		{
			sciprint(_("%s: Error while opening, reading or writing.\n"),"mtell");
		}
		
		*err=1;
		return;
	}
	*err = 0;
	#ifdef _MSC_VER
		#if _WIN64 
			*offset = (double) _ftelli64(fa) ;
		#else
			*offset = (double) ftell(fa) ;
		#endif
	#else
	*offset = (double) ftell(fa) ;
	#endif
}
Пример #3
0
/*--------------------------------------------------------------------------*/
void C2F(mput) (int *fd, double *res, int *n, char *type, int *ierr)
{
  int nc = 0,swap2 = 0;
  FILE *fa = NULL;
  *ierr = 0;
  if ((nc = (int)strlen(type)) == 0)
    {
      if ( getWarningMode() ) sciprint(_("%s: Wrong size for input argument #%d ('%s'): Non-empty string expected.\n"),"mput",4,type);
      *ierr = 2;
      return;
    }

  if ( *fd == -1  &&  GetFileOpenedInScilab(*fd) == NULL )
    {
      sciprint(_("%s: No File opened in Scilab.\n") , "mput" ) ;
      *ierr = 3 ;
      return ;
    }

  if ((fa = GetFileOpenedInScilab(*fd)) !=NULL)
    {
      swap2 = GetSwapStatus(*fd);
      mput2(fa,swap2,res,*n,type,ierr);
      if (*ierr > 0) {
	if ( getWarningMode() ) {
	  sciprint(_("%s: Wrong value for input argument #%d ('%s'): Format not recognized.\n"),"mput",4,type);
	}
      }
    }
  else
    {
      if ( getWarningMode() ) {
	sciprint(_("%s: Error while opening, reading or writing '%s'.\n"),"mput", GetFileNameOpenedInScilab(*fd));
      }
      *ierr=3;
    }
}