Changeset 3851677 in tol
- Timestamp:
- Oct 26, 2008, 7:16:38 PM (18 years ago)
- Branches:
- 1941-docker-image-to-test, devel, master
- Children:
- 997c16c
- Parents:
- b6e52e72
- Location:
- tol/bbasic
- Files:
-
- 2 edited
-
sys.cpp (modified) (1 diff)
-
tol_bsys.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tol/bbasic/sys.cpp
rb6e52e72 r3851677 591 591 } 592 592 593 //-------------------------------------------------------------------- 594 BBool BSys::Cat(const BArray<BText>& origin, const BText& target) 595 596 /*! Cats a set of files into target. 597 * \return Returns true on success, or false if an error occurred 598 */ 599 //-------------------------------------------------------------------- 600 { 601 static const int bufferSize_ = 1024*1024; 602 static char buffer_[bufferSize_]; 603 FILE* in; 604 FILE* out = fopen(target.String(),"wb"); 605 if(!out) 606 { 607 Error(I2("Cannot open for write file ", 608 "No se pudo abrir para escritura el fichero ")+ 609 target); 610 return(false); 611 } 612 int i, numBytes, size, pos; 613 for(i=0; i<origin.Size(); i++) 614 { 615 size = GetFileSize(origin[i]); 616 in = fopen(origin[i].String(),"rb"); 617 if(!in) 618 { 619 Error(I2("Cannot open for read file ", 620 "No se pudo abrir para lectura el fichero ")+ 621 origin[i]); 622 return(false); 623 } 624 pos = 0; 625 while(pos<size) 626 { 627 numBytes = bufferSize_; 628 if(numBytes>size-pos) { numBytes = size-pos; } 629 fread (&buffer_,1,numBytes,in); 630 fwrite(&buffer_,1,numBytes,out); 631 pos += numBytes; 632 } 633 fclose(in); 634 } 635 fclose(out); 636 return(true); 637 } 593 638 594 639 //-------------------------------------------------------------------- -
tol/bbasic/tol_bsys.h
rb6e52e72 r3851677 117 117 bool wait=BFALSE); 118 118 #endif 119 static BBool ChildProcess(const BText& command);119 static BBool ChildProcess(const BText& command); 120 120 //! Prints a file in the default printer. 121 static BBool Print(const BText& fileName);121 static BBool Print(const BText& fileName); 122 122 //! Removes a file 123 static BBool Remove(const BText& fileName);123 static BBool Remove(const BText& fileName); 124 124 //! Copies \a origin file(s) to \a target 125 static BBool Copy (const BText& origin, const BText& target); 125 static BBool Copy(const BText& origin, const BText& target); 126 static BBool Cat(const BArray<BText>& origin, const BText& target); 127 126 128 //! Prints a file in the default printer and removes this file from disk. 127 129 static BBool PrintUnlink(const BText& fileName);
Note: See TracChangeset
for help on using the changeset viewer.
