int main(int argc, char **argv) { //::testing::InitGoogleTest(&argc, argv); //return RUN_ALL_TESTS(); if(argc != 3){ cout << "Uso: " << endl; cout << argv[0] << " -c archivoAComprimir"<< endl; cout << argv[0] << " -d archivoADescomprimir"<< endl; exit(1); } string path=argv[2]; if(!strcmp(argv[1],"-c")){ Compressor * comp = new Compressor(); comp->compress(path); //remove(path.c_str()); delete comp; } if(!strcmp(argv[1],"-d")){ Decompressor * decomp = new Decompressor(); decomp->decompress(path); delete decomp; } return 0; }
int main() { Compressor c; //cout << "compressing" << endl; // c.compress("/auto_home/nlephilippe/Téléchargements/test1.txt", "/auto_home/nlephilippe/Téléchargements/compc"); c.compress("/home/noe/Téléchargements/test1.txt", "/home/noe/Téléchargements/compc"); // cout << endl; Decompressor d; //cout << "decompressing" << endl; //d.decompress("/auto_home/nlephilippe/Téléchargements/compc", "/auto_home/nlephilippe/Téléchargements/outc.bin"); d.decompress("/home/noe/Téléchargements/compc", "/home/noe/Téléchargements/outc.txt"); cout << endl; return 0; }
int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); if (argc < 2) { qDebug("insufficient arguments..."); usage(); exit (0); } QString option = argv[1]; Compressor *c = new Compressor (); if (option == "--help" || option == "/?") { usage(); exit(0); } else if (argc < 4) { qDebug() << "insufficient arguments..."; usage(); exit(0); } if (option == "-c") { c->compress(argv[2], argv[3]); } else if (option == "-d") { c->decompress(argv[2], argv[3]); } else { qDebug("unknown option!"); usage(); exit (0); } delete c; qDebug("Done!"); exit (1); return a.exec(); }
CompressedData *Math::compress(Compressor::Format format, const char *rawbytes, size_t rawsize, int level) { Compressor *compressor = Compressor::getCompressor(format); if (compressor == nullptr) throw love::Exception("Invalid compression format."); size_t compressedsize = 0; char *cbytes = compressor->compress(format, rawbytes, rawsize, level, compressedsize); CompressedData *data = nullptr; try { data = new CompressedData(format, cbytes, compressedsize, rawsize, true); } catch (love::Exception &) { delete[] cbytes; throw; } return data; }
int main(int argc, char *argv[], char *envp[]) { int RValue = false; int CaptureModeHex = 0; int NewChar=0; printf ("main - start\n"); Compressor* pCmp = new Compressor(new ZIP_Compression); pCmp->compress( "file.txt"); pCmp = new Compressor(new ARJ_Compression); pCmp->compress( "file.txt"); RAR_Compression *p_rar = new RAR_Compression(); pCmp = new Compressor(p_rar); pCmp->compress( "file.txt"); delete pCmp; //own_car *pOwn_Car = new own_car(); //pOwn_Car->drive(); TakeTransport * pTakeTransp = new TakeTransport(); pTakeTransp->setStrategy(2); pTakeTransp->doIt(); // // // //*************MAIN LOOP*****************// cout << "\n$ > Press any key to exit....." << std::endl; do { //This is simple Windows way: Sleep(55); // active_matrix->run_matrix(); //nResult = produceRND(); //printf ("1-Time: %ld. RND: %d\n", _time->Get1msTimeMS(), nResult); //nResult = produceRND(); //printf ("2-Time: %ld. RND: %d\n", _time->Get1msTimeMS(), nResult); // control of endless loop (may be also in monitor.cpp) if (_kbhit()) // has anything been pressed from keyboard ? { NewChar=(unsigned char)_getch(); RValue = true; if ((NewChar & 0xff) == 24) // CTRL-X pressed { RValue = true; // END mark } if (NewChar == 'd') // pressed { if (1 == CaptureModeHex) CaptureModeHex = 1; else CaptureModeHex = 0; } } } while (!RValue); printf ("Application complete.\n"); return 0; }
//-------------------------------------------------------------- bool Compress(const u8* buffer, int size, io::File* ostream) { Compressor compr; return compr.compress(buffer, size, ostream) && compr.finish(ostream); }
void BehaviourPatterns::cStrategy() { Compressor* c = new Compressor( new ZIP_Compression() ); c->compress("file.txt"); delete c; }