[Index for tmp_for_tar/misc]
[Return to Master Index]
todisk
(tmp_for_tar/misc/todisk.m)
Function Synopsis
todisk(outname,...)
Help text
todisk(outname,s1,...)
Writes strings s1,... to file outname.
"outname" should only contain the charater ">" as ">>" at the
beginning , to indicate append rather than overwriting the
file.
Last modified: April 2000
Cross-Reference Information
This function calls
- sayif tmp_for_tar/misc/sayif.m
Listing of function file tmp_for_tar/misc/todisk.m
## todisk(outname,s1,...)
##
## Writes strings s1,... to file outname.
##
## "outname" should only contain the charater ">" as ">>" at the
## beginning , to indicate append rather than overwriting the
## file.
## Author: Etienne Grossmann <etienne@isr.ist.utl.pt>
## Last modified: April 2000
function todisk(outname,...)
verbose = 1 ;
append = 0;
if ! isstr(outname) ,
error "todisk wants a string as first arg"
end
if strcmp(outname(1:2),">>"),
append = 1
end
outname = strrep(outname,">","")
## outname = strrep(outname,".wrl",''); # No suffix.
## fname = sprintf("%s.wrl",outname); # Add suffix.
fname = outname ;
## No path.
if findstr(outname,"/"),
outname = outname(max(findstr(outname,"/"))+1:size(outname,2)) ;
end
if append, fid = fopen(fname,"a"); # Saving.
else fid = fopen(fname,"w");
end ;
if fid == -1 , error(sprintf("todisk : unable to open %s",fname)); end
## Put header.
## fprintf(fid,"#VRML V2.0 utf8 \n# %s , created by todisk.m on %s \n",
## fname,datestr());
i = 1 ;
while --nargin ,
## tmp = va_arg();
sayif(verbose,"todisk : %i'th string\n",i) ;
fprintf(fid,va_arg()) ;
i++ ;
end
fprintf(fid,"\n");
fclose(fid);
Produced by oct2html on Sat Apr 28 21:14:54 2001
Cross-Directory links are: ON