Localization (fileio)
[scilab.git] / scilab / modules / fileio / sci_gateway / c / sci_deletefile.c
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) 2007 - INRIA - Allan CORNET
4  * ...
5  * 
6  * This file must be used under the terms of the CeCILL.
7  * This source file is licensed as described in the file COPYING, which
8  * you should have received as part of this distribution.  The terms
9  * are also available at    
10  * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
11  *
12  */
13 /*--------------------------------------------------------------------------*/
14 #include "gw_fileio.h"
15 #include "stack-c.h"
16 #include "MALLOC.h"
17 #include "Scierror.h"
18 #include "deleteafile.h"
19 #include "localization.h"
20 /*--------------------------------------------------------------------------*/
21 int C2F(sci_deletefile)(char *fname,unsigned long fname_len)
22 {
23         CheckRhs(1,1);
24         CheckLhs(1,1);
25
26         if (GetType(1) == sci_strings)
27         {
28                 int m1,n1,l1;
29                 char *VarName=NULL;
30
31                 GetRhsVar(1,STRING_DATATYPE,&m1,&n1,&l1);
32                 VarName=cstk(l1);
33
34                 n1=1;
35                 if ( deleteafile(VarName) )
36                 {
37                         CreateVar(Rhs+1,MATRIX_OF_BOOLEAN_DATATYPE, &n1,&n1,&l1);
38                         *istk(l1)=(int)(TRUE);
39                 }
40                 else
41                 {
42                         CreateVar(Rhs+1,MATRIX_OF_BOOLEAN_DATATYPE, &n1,&n1,&l1);
43                         *istk(l1)=(int)(FALSE);
44                 }
45
46                 LhsVar(1)=Rhs+1;
47                 C2F(putlhsvar)();
48         }
49         else
50         {
51                 Scierror(999,_("%s: Wrong type for input argument: String expected.\n"),fname);
52         }
53         return 0;
54 }
55 /*--------------------------------------------------------------------------*/