Copy a file, byte for byte

Other topics

Copying any file, byte by byte

/* these IN and OUT filerefs can point to anything */
filename in "anyfilehere.xlsx"; 
filename out "anyfilehere.xlsx"; 


/* copy the file byte-for-byte  */
data _null_;
  length filein 8 fileid 8;
  filein = fopen('in','I',1,'B');
  fileid = fopen('out','O',1,'B');
  rec = '20'x;
  do while(fread(filein)=0);
     rc = fget(filein,rec,1);
     rc = fput(fileid, rec);

     rc =fwrite(fileid);
  end;
  rc = fclose(filein);
  rc = fclose(fileid);
run;
 
filename in clear;
filename out clear;

Contributors

Topic Id: 9394

Example Ids: 29109

This site is not affiliated with any of the contributors.