diff options
Diffstat (limited to 'macros/GeneralFunctions/SCI2Ccopyfile.sci')
-rw-r--r-- | macros/GeneralFunctions/SCI2Ccopyfile.sci | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/macros/GeneralFunctions/SCI2Ccopyfile.sci b/macros/GeneralFunctions/SCI2Ccopyfile.sci index f95c29ef..40d43f40 100644 --- a/macros/GeneralFunctions/SCI2Ccopyfile.sci +++ b/macros/GeneralFunctions/SCI2Ccopyfile.sci @@ -1,49 +1,49 @@ -function SCI2Ccopyfile(InFileName,OutFileName,CopyMode)
-// function SCI2Ccopyfile(InFileName,OutFileName,CopyMode)
-// -----------------------------------------------------------------
-// #RNU_RES_B
-// Copy the contents of infile into outfile. Append mode is used.
-//
-// Input data:
-// InFileName: path+filename of the input file.
-// OutFileName: path+filename of the input file.
-// CopyMode: 'append' or 'overwrite'
-// #RNU_RES_E
-//
-// Output data:
-// ---
-//
-// Status:
-// 23-Nov-2007 -- Raffaele Nutricato: Author.
-//
-// Copyright 2007 Raffaele Nutricato
-// -----------------------------------------------------------------
-
-// ------------------------------
-// --- Check input arguments. ---
-// ------------------------------
-SCI2CNInArgCheck(argn(2),3,3);
-
-if (CopyMode == 'append')
- // ------------------------
- // --- Open Input file. ---
- // ------------------------
- fidIn = SCI2COpenFileRead(InFileName);
-
- // -------------------
- // --- Read lines. ---
- // -------------------
- tmpline = mgetl(fidIn,1);
- while (meof(fidIn) == 0)
- PrintStringInfo(tmpline, OutFileName, 'file', 'y');
- tmpline = mgetl(fidIn,1);
- end
- mclose(fidIn);
-elseif (CopyMode == 'overwrite')
- PrintStringInfo(' ', OutFileName, 'file', 'y'); // Cannot use scilab copyfile when the directory is empty!.
- copyfile(InFileName,OutFileName);
-else
- SCI2Cerror('Unknown CopyMode: ""'+CopyMode+'""');
-end
-
-endfunction
+function SCI2Ccopyfile(InFileName,OutFileName,CopyMode) +// function SCI2Ccopyfile(InFileName,OutFileName,CopyMode) +// ----------------------------------------------------------------- +// #RNU_RES_B +// Copy the contents of infile into outfile. Append mode is used. +// +// Input data: +// InFileName: path+filename of the input file. +// OutFileName: path+filename of the input file. +// CopyMode: 'append' or 'overwrite' +// #RNU_RES_E +// +// Output data: +// --- +// +// Status: +// 23-Nov-2007 -- Raffaele Nutricato: Author. +// +// Copyright 2007 Raffaele Nutricato +// ----------------------------------------------------------------- + +// ------------------------------ +// --- Check input arguments. --- +// ------------------------------ +SCI2CNInArgCheck(argn(2),3,3); + +if (CopyMode == 'append') + // ------------------------ + // --- Open Input file. --- + // ------------------------ + fidIn = SCI2COpenFileRead(InFileName); + + // ------------------- + // --- Read lines. --- + // ------------------- + tmpline = mgetl(fidIn,1); + while (meof(fidIn) == 0) + PrintStringInfo(tmpline, OutFileName, 'file', 'y'); + tmpline = mgetl(fidIn,1); + end + mclose(fidIn); +elseif (CopyMode == 'overwrite') + PrintStringInfo(' ', OutFileName, 'file', 'y'); // Cannot use scilab copyfile when the directory is empty!. + copyfile(InFileName,OutFileName); +else + SCI2Cerror('Unknown CopyMode: ""'+CopyMode+'""'); +end + +endfunction |