diff options
Diffstat (limited to 'src/Scilab2C/GeneralFunctions/filenamefprintf.sci')
-rw-r--r-- | src/Scilab2C/GeneralFunctions/filenamefprintf.sci | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/Scilab2C/GeneralFunctions/filenamefprintf.sci b/src/Scilab2C/GeneralFunctions/filenamefprintf.sci new file mode 100644 index 00000000..98a0cba2 --- /dev/null +++ b/src/Scilab2C/GeneralFunctions/filenamefprintf.sci @@ -0,0 +1,39 @@ +function filenamefprintf(filename,ennewline,str)
+// function filenamefprintf(filename,ennewline,str)
+// --------------------------------------------------------------------------------
+// Uses the printf to print the string specified by varargin. filenamefprintf
+// uses the filename instead of the fid parameter used by fprintf.
+// Everytime filenamefprintf is called it
+// opens the file, prints the string in it and then closes it.
+// Opening is performed in read/append mode (at+).
+//
+// Input data:
+// filename: string that specifies the name of the file.
+// varargin are the input arguments for the printf.
+//
+// Output data:
+//
+// Status:
+// 31-Jan-2006 -- Nutricato Raffaele: Author.
+// 31-Jan-2006 -- Nutricato Raffaele: TEST OK.
+// --------------------------------------------------------------------------------
+
+
+ if argn(2) < 3 then
+ SCI2Cerror('Incorrect number of input arguments.');
+ end
+
+// [FidReportFile, mess] = mopen(deblank(filename),'at+');
+ [FidReportFile, mess] = mopen(filename,'a+');
+ if (FidReportFile == -1) then
+ SCI2Cerror(mess);
+ end
+
+ if ennewline=='y' then
+ mfprintf(FidReportFile,'%s\n',str);
+ else
+ mfprintf(FidReportFile,'%s',str);
+ end
+ mclose(FidReportFile);
+
+endfunction
|