summaryrefslogtreecommitdiff
path: root/macros/GeneralFunctions/filenamefprintf.sci
diff options
context:
space:
mode:
authornutricato2009-06-04 04:51:29 +0000
committernutricato2009-06-04 04:51:29 +0000
commit79f469725862e0bc1ee1be9b7e2d6cdb12911e76 (patch)
tree0db6989ea1dcb99723f2e5722335d52b2aaaa279 /macros/GeneralFunctions/filenamefprintf.sci
parent25f850906710d1da7291f48fa4cb89c4d82ca33b (diff)
downloadscilab2c-79f469725862e0bc1ee1be9b7e2d6cdb12911e76.tar.gz
scilab2c-79f469725862e0bc1ee1be9b7e2d6cdb12911e76.tar.bz2
scilab2c-79f469725862e0bc1ee1be9b7e2d6cdb12911e76.zip
Diffstat (limited to 'macros/GeneralFunctions/filenamefprintf.sci')
-rw-r--r--macros/GeneralFunctions/filenamefprintf.sci15
1 files changed, 10 insertions, 5 deletions
diff --git a/macros/GeneralFunctions/filenamefprintf.sci b/macros/GeneralFunctions/filenamefprintf.sci
index 34875e99..0b64bd88 100644
--- a/macros/GeneralFunctions/filenamefprintf.sci
+++ b/macros/GeneralFunctions/filenamefprintf.sci
@@ -1,5 +1,5 @@
-function filenamefprintf(filename,ennewline,str)
-// function filenamefprintf(filename,ennewline,str)
+function filenamefprintf(filename,ennewline,str,formattedstring)
+// function filenamefprintf(filename,ennewline,str,formattedstring)
// --------------------------------------------------------------------------------
// Uses the printf to print the string specified by varargin. filenamefprintf
// uses the filename instead of the fid parameter used by fprintf.
@@ -10,6 +10,8 @@ function filenamefprintf(filename,ennewline,str)
// Input data:
// filename: string that specifies the name of the file.
// varargin are the input arguments for the printf.
+// formattedstring: if 'n' (default) it means that str is considered as a simple string (mputstr).
+// if 'y' then str is considered formatted according to mfprint syntax
//
// Output data:
// ---
@@ -25,7 +27,7 @@ function filenamefprintf(filename,ennewline,str)
// ------------------------------
// --- Check input arguments. ---
// ------------------------------
-SCI2CNInArgCheck(argn(2),3,3);
+SCI2CNInArgCheck(argn(2),4,4);
// [FidReportFile, mess] = mopen(deblank(filename),'at+');
@@ -33,10 +35,13 @@ SCI2CNInArgCheck(argn(2),3,3);
if (FidReportFile == -1) then
SCI2Cerror(mess);
end
- if ennewline=='y' then
- mfprintf(FidReportFile, str+'\n');
+ if formattedstring == 'n'
+ mputstr(str,FidReportFile);
else
mfprintf(FidReportFile, str);
+ end
+ if ennewline=='y' then
+ mfprintf(FidReportFile,'\n');
end
mclose(FidReportFile);