void BlockStreamProfileInfo::write(WriteBuffer & out) const
{
	writeVarUInt(rows, out);
	writeVarUInt(blocks, out);
	writeVarUInt(bytes, out);
	writeBinary(hasAppliedLimit(), out);
	writeVarUInt(getRowsBeforeLimit(), out);
	writeBinary(calculated_rows_before_limit, out);
}
Exemplo n.º 2
0
int main(int argc, char* argv[]) {
  
  if (argc < 3) {
    printInfo();

    return 0;  
  }
	
  char* flag = argv[1];

  if (strcmp(flag, "-c") == 0) {
    int fileSize;
	
    //get the buffer from the input file 
    const char* inBuffer = getBufferFromFile(argv[2], fileSize);

    //make the compressor
    HuffmanCompressor compressor = HuffmanCompressor((char*)inBuffer, fileSize);

    long compSize;
    //compress the data
    unsigned char* compressedData = compressor.compress(compSize);

    std::string path = std::string(argv[2]) + ".bzip";

    //write the compressed data to the disk
    writeBinary(compressedData, compSize, path);

    delete [] compressedData;

    delete [] inBuffer;

    return 0;
  }

  else if (strcmp(flag, "-d") == 0) {
    std::fstream in(argv[2], std::ios::in|std::ios::binary);

    HuffmanDecompressor dec = HuffmanDecompressor(in);

    BYTE* data = dec.decompress();

    int dataSize = dec.getTotalChars();

    writeBinary(data, dataSize, "out.txt");

    delete [] data;

    return 0;
  }

  else {
    printInfo();
  }

  return 0;
}
Exemplo n.º 3
0
void NativeBlockOutputStream::write(const Block & block)
{
    /// Additional information about the block.
    if (client_revision >= DBMS_MIN_REVISION_WITH_BLOCK_INFO)
        block.info.write(ostr);

    /// Dimensions
    size_t columns = block.columns();
    size_t rows = block.rows();

    writeVarUInt(columns, ostr);
    writeVarUInt(rows, ostr);

    /** The index has the same structure as the data stream.
      * But instead of column values, it contains a mark that points to the location in the data file where this part of the column is located.
      */
    if (index_ostr)
    {
        writeVarUInt(columns, *index_ostr);
        writeVarUInt(rows, *index_ostr);
    }

    for (size_t i = 0; i < columns; ++i)
    {
        /// For the index.
        MarkInCompressedFile mark;

        if (index_ostr)
        {
            ostr_concrete->next();  /// Finish compressed block.
            mark.offset_in_compressed_file = initial_size_of_file + ostr_concrete->getCompressedBytes();
            mark.offset_in_decompressed_block = ostr_concrete->getRemainingBytes();
        }

        const ColumnWithTypeAndName & column = block.safeGetByPosition(i);

        /// Name
        writeStringBinary(column.name, ostr);

        /// Type
        writeStringBinary(column.type->getName(), ostr);

        /// Data
        if (rows)    /// Zero items of data is always represented as zero number of bytes.
            writeData(*column.type, column.column, ostr, 0, 0);

        if (index_ostr)
        {
            writeStringBinary(column.name, *index_ostr);
            writeStringBinary(column.type->getName(), *index_ostr);

            writeBinary(mark.offset_in_compressed_file, *index_ostr);
            writeBinary(mark.offset_in_decompressed_block, *index_ostr);
        }
    }
}
Exemplo n.º 4
0
int main(int argc, char *argv[])
{
	if(argc == 2)
	{
		switch(*argv[1])
		{
			case '1':
				ON = ON_1;
				OFF = OFF_1;
				break;
			case '2':
				ON = ON_2;
				OFF = OFF_2;
				break;	
			default:
				ON=ON_0;
				OFF=OFF_0;
				break;
		}
	}
	setlocale(LC_ALL,"");
	initscr();
	curs_set(0);
	tm *tm_struct;
	int prev_sec = -1;
	time_t t;
	do{
		t = time(NULL);
		tm_struct = localtime(&t);
		int hour = tm_struct->tm_hour;
		int minute = tm_struct->tm_min;
		int seconds = tm_struct->tm_sec;
		if(prev_sec != seconds){
			prev_sec = seconds;
			clear();
			writeBinary(hour);
			printw("\n");
			writeBinary(minute);
			printw("\n");
			writeBinary(seconds);
			refresh();
		}
		usleep(50000);
	}while(true);

	endwin();
	return 0;
}
void writeBinary<std::vector<uint8_t>>(std::ostream& out, const std::vector<uint8_t>& arg) {
   size_t len = arg.size();
   out.write((char*)&len, sizeof(size_t));
   for(auto& val: arg){
      writeBinary(out, val);
   }
}
Exemplo n.º 6
0
void VdyneScanCloud::writeBinary(std::ostream& stream) const {
  BinaryStreamWriter<std::ostream> binaryStream(stream);
  const size_t numScans = mScans.size();
  binaryStream << mTimestamp << mStartRotationAngle << mEndRotationAngle
    << numScans;
  for (auto it = getScanBegin(); it != getScanEnd(); ++it)
    it->writeBinary(stream);
}
void BinaryFileTreeDataStateBase::saveDataState(const phantom::data& a_Data, uint guid, Node* a_pNode, uint a_uiStateId)
{
    BinaryFileTreeDataBase* pDB = static_cast<BinaryFileTreeDataBase*>(a_pNode->getDataBase());
	byte buffer[1000000];
	byte* pBuffer = &(buffer[0]);
	a_Data.type()->serialize(a_Data.address(), pBuffer, m_uiSerializationFlag, pDB);
    writeBinary(dataPath(a_Data, guid, a_pNode, a_uiStateId), &(buffer[0]), pBuffer - &(buffer[0]));
}
Exemplo n.º 8
0
//int main() {  this causes a name collision when hosted on linux...
int parser_main() {
    // pick some maximum identifier length, e.g. 42 characters
    maxIdentifierLength = 42;

    LINK = 31;
    SP = 30;
    FP = 29;
    GP = 28;
    RR = 27;
    // ...

    ZR = 0;

    allocatedRegisters = 0;
    allocatedGlobalVariables = 0;

    ADD = 7; // opcode for ADD
    SUB = 8; // opcode for SUB
    // ...

    symbolTable = 0;

    // pick some maximum code length, e.g. 16K * 4 bytes = 64KB
    // increase as needed
    maxCodeLength = 16384;

    // allocate memory for emitting code
    code = malloc(maxCodeLength * 4);
    codeLength = 0;

    // start executing by branching to main procedure
    // please do not forget: parameter c requires fixup
    // when code location for main procedure is known
    emitCode(BSR, 0, 0, 0);

    // push exit code in return register onto stack
    emitCode(PSH, RR, SP, 4);

    // halt machine by invoking exit
    emitCode(BSR, 0, 0, codeLength + 1);

    // emit library code for exit right here
    emitExit();

    // similarly, emit library code for malloc, getchar, and putchar
    // ...

    // get first symbol from scanner
    getSymbol();

    // invoke compiler, implement missing procedures
    cstar();

    // write code to standard output
    writeBinary();

    return 0;
}
Exemplo n.º 9
0
void DataTypeNullable::serializeBinary(const IColumn & column, size_t row_num, WriteBuffer & ostr) const
{
    const ColumnNullable & col = static_cast<const ColumnNullable &>(column);

    bool is_null = col.isNullAt(row_num);
    writeBinary(is_null, ostr);
    if (!is_null)
        nested_data_type->serializeBinary(*col.getNestedColumn(), row_num, ostr);
}
inline
void
SeededSliceExtractor<DataSetWrapperParam>::Parameters::write(
	Comm::MulticastPipe& pipe,
	const Visualization::Abstract::VariableManager* variableManager) const
	{
	/* Write to multicast pipe: */
	writeBinary(pipe,true,variableManager);
	}
Exemplo n.º 11
0
  bool AbstractOccupancyOcTree::writeBinary(const std::string& filename){
    std::ofstream binary_outfile( filename.c_str(), std::ios_base::binary);

    if (!binary_outfile.is_open()){
      OCTOMAP_ERROR_STR("Filestream to "<< filename << " not open, nothing written.");
      return false;
    }
    return writeBinary(binary_outfile);
  }
Exemplo n.º 12
0
void MonophoneLookup::writeBinary( const char *binFName )
{
   FILE *fd ;
   if ( (fd = fopen( binFName ,"wb" )) == NULL )
      error("MonophoneLookup::writeBinary(2) - error opening binFName") ;

   writeBinary( fd ) ;

   fclose( fd ) ;
}
Exemplo n.º 13
0
bool TwoDAFile::writeBinary(const Common::UString &fileName) const {
	Common::WriteFile file;
	if (!file.open(fileName))
		return false;

	writeBinary(file);
	file.close();

	return true;
}
Exemplo n.º 14
0
void TraceThreadListener::traceWrite()
{
  if (!OutputEnabled)
    return;
  
  // Terminate the event stream.
  EventsOut.write<EventType::TraceEnd>(0);
  
  // Write the trace information.
  auto TraceOut = StreamAllocator.getThreadStream(ThreadID,
                                                  ThreadSegment::Trace);
  assert(TraceOut && "Couldn't get thread trace stream.");
  
  offset_uint Written = 0;

  // Calculate the offset position of the first (top-level functions) list.
  offset_uint ListOffset = getNewFunctionRecordOffset();

  // Write offset of top-level function list.
  Written += writeBinary(*TraceOut, ListOffset);
  
  // Calculate offset of the next function list.
  ListOffset += getWriteBinarySize(RecordedTopLevelFunctions);

  // Write function information.
  for (auto const &Function: RecordedFunctions) {
    Written += writeBinary(*TraceOut, Function->getIndex());
    Written += writeBinary(*TraceOut, Function->getEventOffsetStart());
    Written += writeBinary(*TraceOut, Function->getEventOffsetEnd());
    Written += writeBinary(*TraceOut, Function->getThreadTimeEntered());
    Written += writeBinary(*TraceOut, Function->getThreadTimeExited());
    
    // Write offset of the child function list.
    Written += writeBinary(*TraceOut, ListOffset);
    
    // Calculate offset of the next function list.
    ListOffset += getWriteBinarySize(Function->getChildren());
  }

  // Write the top-level function list.
  Written += writeBinary(*TraceOut, RecordedTopLevelFunctions);

  // Write the child lists.
  for (auto const &Function: RecordedFunctions) {
    Written += writeBinary(*TraceOut, Function->getChildren());
  }
}
Exemplo n.º 15
0
void OcTreePCL::writeBinary(const std::string& filename){
  std::ofstream binary_outfile( filename.c_str(), std::ios_base::binary);

  if (!binary_outfile.is_open()){
    std::cerr << "ERROR: Filestream to "<< filename << " not open, nothing written.\n";
    return;
  } else {
    writeBinary(binary_outfile);
    binary_outfile.close();
  }
}
Exemplo n.º 16
0
int main(int argc, char *argv[]) {
	if (argc==3) {
		printf("Textfile will be %s and binary file will be %s \n", argv[2],argv[1]);
	} else {
		printf("Wrong number of parameters\n");
		return(1);
	}
	writeBinary(argv[2],argv[1]);
	testRead(argv[2]);
	return 0;
}
Exemplo n.º 17
0
// compression
void compress(FILE *inputFile, FILE *outputFile) {    
    int prefix = getc(inputFile);
    if (prefix == EOF) {
        return;
    }
    int character;

    int nextCode;
    int index;
    
    // LZW starts out with a dictionary of 256 characters (in the case of 8 codeLength) and uses those as the "standard"
    //  character set.
    nextCode = 256; // next code is the next available string code
    dictionaryInit();
    
    // while (there is still data to be read)
    while ((character = getc(inputFile)) != (unsigned)EOF) { // ch = read a character;
        
        // if (dictionary contains prefix+character)
        if ((index = dictionaryLookup(prefix, character)) != -1) prefix = index; // prefix = prefix+character
        else { // ...no, try to add it
            // encode s to output file
            writeBinary(outputFile, prefix);
            
            // add prefix+character to dictionary
            if (nextCode < dictionarySize) dictionaryAdd(prefix, character, nextCode++);
            
            // prefix = character
            prefix = character; //... output the last string after adding the new one
        }
    }
    // encode s to output file
    writeBinary(outputFile, prefix); // output the last code
    
    if (leftover > 0) fputc(leftoverBits << 4, outputFile);
    
    // free the dictionary here
    dictionaryDestroy();
}
Exemplo n.º 18
0
 Writer& Writer::writeIntValueImpl(T value)
 {
     beginValue();
     if (!(m_LanguagExtensions & INTEGERS_AS_HEX))
         *m_Stream << value;
     else if ((m_LanguagExtensions & INTEGERS_AS_HEX) == INTEGERS_AS_HEX)
         *m_Stream << "\"0x" << std::hex << std::uppercase << value << '"' << std::dec;
     else if (m_LanguagExtensions & INTEGERS_AS_OCT)
         *m_Stream << "\"0o" << std::oct << value << '"' << std::dec;
     else if (m_LanguagExtensions & INTEGERS_AS_BIN)
         writeBinary(*m_Stream, value);
     m_State = AT_END_OF_VALUE;
     return *this;
 }
Exemplo n.º 19
0
static void GetCryptoSeed(uchar *seed, uint seed_size, char *seed_file)
{
	if(isFactoryDirEnabled())
	{
		autoBlock_t gab;

		mutex();

		// zantei >

		if(existFile(seed_file) && getFileSize(seed_file) != (uint64)seed_size)
		{
			cout("#########################################################\n");
			cout("## SEED_FILE SIZE ERROR -- どっかに古い exe があるで! ##\n");
			cout("#########################################################\n");

			removeFile(seed_file);
		}

		// < zantei

		if(existFile(seed_file))
		{
			FILE *fp;
			uint index;

			fp = fileOpen(seed_file, "rb");
			fileRead(fp, gndBlockVar(seed, seed_size, gab));
			fileClose(fp);

			for(index = 0; index < seed_size; index++)
			{
				if(seed[index] < 0xff)
				{
					seed[index]++;
					break;
				}
				seed[index] = 0x00;
			}
		}
		else
			getCryptoBlock_MS(seed, seed_size);

		writeBinary(seed_file, gndBlockVar(seed, seed_size, gab));
		unmutex();
	}
	else
		getCryptoBlock_MS(seed, seed_size);
}
Exemplo n.º 20
0
void KdbxXmlWriter::writeIcon(const QUuid& uuid, const QImage& icon)
{
    m_xml.writeStartElement("Icon");

    writeUuid("UUID", uuid);

    QByteArray ba;
    QBuffer buffer(&ba);
    buffer.open(QIODevice::WriteOnly);
    // TODO: check !icon.save()
    icon.save(&buffer, "PNG");
    buffer.close();
    writeBinary("Data", ba);

    m_xml.writeEndElement();
}
Exemplo n.º 21
0
void MessageEncoder::writeProperties(const Properties& msg)
{
    size_t fields(optimise ? optimisable(msg) : 13);
    if (fields) {
        void* token = startList32(&qpid::amqp::message::PROPERTIES);
        if (msg.hasMessageId()) writeString(msg.getMessageId());
        else writeNull();

        if (msg.hasUserId()) writeBinary(msg.getUserId());
        else if (fields > 1) writeNull();

        if (msg.hasTo()) writeString(msg.getTo());
        else if (fields > 2) writeNull();

        if (msg.hasSubject()) writeString(msg.getSubject());
        else if (fields > 3) writeNull();

        if (msg.hasReplyTo()) writeString(msg.getReplyTo());
        else if (fields > 4) writeNull();

        if (msg.hasCorrelationId()) writeString(msg.getCorrelationId());
        else if (fields > 5) writeNull();

        if (msg.hasContentType()) writeSymbol(msg.getContentType());
        else if (fields > 6) writeNull();

        if (msg.hasContentEncoding()) writeSymbol(msg.getContentEncoding());
        else if (fields > 7) writeNull();

        if (msg.hasAbsoluteExpiryTime()) writeLong(msg.getAbsoluteExpiryTime());
        else if (fields > 8) writeNull();

        if (msg.hasCreationTime()) writeLong(msg.getCreationTime());
        else if (fields > 9) writeNull();

        if (msg.hasGroupId()) writeString(msg.getGroupId());
        else if (fields > 10) writeNull();

        if (msg.hasGroupSequence()) writeUInt(msg.getGroupSequence());
        else if (fields > 11) writeNull();

        if (msg.hasReplyToGroupId()) writeString(msg.getReplyToGroupId());
        else if (fields > 12) writeNull();

        endList32(fields, token);
    }
}
Exemplo n.º 22
0
  llvm::Error writeFile(const lld::File &file, StringRef path) override {
    // Construct empty normalized file from atoms.
    llvm::Expected<std::unique_ptr<NormalizedFile>> nFile =
        normalized::normalizedFromAtoms(file, _ctx);
    if (auto ec = nFile.takeError())
      return ec;

    // For testing, write out yaml form of normalized file.
    if (_ctx.printAtoms()) {
      std::unique_ptr<Writer> yamlWriter = createWriterYAML(_ctx);
      if (auto ec = yamlWriter->writeFile(file, "-"))
        return ec;
    }

    // Write normalized file as mach-o binary.
    return writeBinary(*nFile->get(), path);
  }
inline
void
SeededSliceExtractor<DataSetWrapperParam>::Parameters::write(
	Comm::ClusterPipe& pipe,
	const Visualization::Abstract::VariableManager* variableManager) const
	{
	/* Calculate the byte size of the marshalled parameter packet: */
	size_t packetSize=0;
	packetSize+=getScalarVariableNameLength(scalarVariableIndex,variableManager);
	packetSize+=sizeof(Scalar)*dimension+sizeof(Scalar);
	packetSize+=sizeof(Scalar)*dimension;
	
	/* Write the packet size to the cluster pipe: */
	pipe.write<unsigned int>(packetSize);
	
	/* Write to cluster pipe: */
	writeBinary(pipe,false,variableManager);
	}
Exemplo n.º 24
0
void Service::processQuery(const Poco::Net::HTMLForm & params, ReadBuffer & body, WriteBuffer & out)
{
	if (is_cancelled)
		throw Exception{"RemoteQueryExecutor service terminated", ErrorCodes::ABORTED};

	std::string query = params.get("query");

	bool flag = true;

	try
	{
		(void) executeQuery(query, context, true);
	}
	catch (...)
	{
		tryLogCurrentException(__PRETTY_FUNCTION__);
		flag = false;
	}

	writeBinary(flag, out);
	out.next();
}
inline
void
SeededSliceExtractor<DataSetWrapperParam>::Parameters::write(
	Misc::File& file,
	bool ascii,
	const Visualization::Abstract::VariableManager* variableManager) const
	{
	if(ascii)
		{
		/* Write to ASCII file: */
		file.write("{\n",2);
		writeScalarVariableNameAscii<Misc::File>(file,"scalarVariable",scalarVariableIndex,variableManager);
		writeParameterAscii<Misc::File,Plane>(file,"plane",plane);
		writeParameterAscii<Misc::File,Point>(file,"seedPoint",seedPoint);
		file.write("}\n",2);
		}
	else
		{
		/* Write to binary file: */
		writeBinary(file,false,variableManager);
		}
	}
Exemplo n.º 26
0
void KdbxXmlWriter::writeMetadata()
{
    m_xml.writeStartElement("Meta");
    writeString("Generator", m_meta->generator());
    if (m_kdbxVersion < KeePass2::FILE_VERSION_4 && !m_headerHash.isEmpty()) {
        writeBinary("HeaderHash", m_headerHash);
    }
    writeString("DatabaseName", m_meta->name());
    writeDateTime("DatabaseNameChanged", m_meta->nameChanged());
    writeString("DatabaseDescription", m_meta->description());
    writeDateTime("DatabaseDescriptionChanged", m_meta->descriptionChanged());
    writeString("DefaultUserName", m_meta->defaultUserName());
    writeDateTime("DefaultUserNameChanged", m_meta->defaultUserNameChanged());
    writeNumber("MaintenanceHistoryDays", m_meta->maintenanceHistoryDays());
    writeColor("Color", m_meta->color());
    writeDateTime("MasterKeyChanged", m_meta->masterKeyChanged());
    writeNumber("MasterKeyChangeRec", m_meta->masterKeyChangeRec());
    writeNumber("MasterKeyChangeForce", m_meta->masterKeyChangeForce());
    writeMemoryProtection();
    writeCustomIcons();
    writeBool("RecycleBinEnabled", m_meta->recycleBinEnabled());
    writeUuid("RecycleBinUUID", m_meta->recycleBin());
    writeDateTime("RecycleBinChanged", m_meta->recycleBinChanged());
    writeUuid("EntryTemplatesGroup", m_meta->entryTemplatesGroup());
    writeDateTime("EntryTemplatesGroupChanged", m_meta->entryTemplatesGroupChanged());
    writeUuid("LastSelectedGroup", m_meta->lastSelectedGroup());
    writeUuid("LastTopVisibleGroup", m_meta->lastTopVisibleGroup());
    writeNumber("HistoryMaxItems", m_meta->historyMaxItems());
    writeNumber("HistoryMaxSize", m_meta->historyMaxSize());
    if (m_kdbxVersion >= KeePass2::FILE_VERSION_4) {
        writeDateTime("SettingsChanged", m_meta->settingsChanged());
    }
    if (m_kdbxVersion < KeePass2::FILE_VERSION_4) {
        writeBinaries();
    }
    writeCustomData(m_meta->customData());

    m_xml.writeEndElement();
}
Exemplo n.º 27
0
void writeException(const Exception & e, WriteBuffer & buf, bool with_stack_trace)
{
    writeBinary(e.code(), buf);
    writeBinary(String(e.name()), buf);
    writeBinary(e.displayText(), buf);

    if (with_stack_trace)
        writeBinary(e.getStackTrace().toString(), buf);
    else
        writeBinary(String(), buf);

    bool has_nested = e.nested() != nullptr;
    writeBinary(has_nested, buf);

    if (has_nested)
        writeException(Exception(Exception::CreateFromPoco, *e.nested()), buf, with_stack_trace);
}
Exemplo n.º 28
0
std::string ReshardingJob::toString() const
{
    std::string serialized_job;
    WriteBufferFromString buf{serialized_job};

    writeBinary(database_name, buf);
    writeBinary(table_name, buf);
    writeBinary(partition, buf);
    writeBinary(queryToString(sharding_key_expr), buf);
    writeBinary(coordinator_id, buf);
    writeVarUInt(block_number, buf);
    writeBinary(do_copy, buf);

    writeVarUInt(paths.size(), buf);
    for (const auto & path : paths)
    {
        writeBinary(path.first, buf);
        writeVarUInt(path.second, buf);
    }
    buf.next();

    return serialized_job;
}
Exemplo n.º 29
0
int main(){
  scampRec_t current;
  while (readAscii(stdin, &current) != EOF)
    writeBinary(stdout, &current);
  return 0;
}
Exemplo n.º 30
0
int main(int argc, char** argv)
{
	int startx;
	int starty;
	int newwidth;
	int newheight;
	
	char infile[256];
	char outfile[256];
	
	int w;
	int h;
	
	unsigned char data;
	unsigned char data1;
	unsigned char data2;
	unsigned char data3;
	
	simp temp;
	FILE* binary;
	simp newSimp;
	int i;
	int j;
	
	if (argv[1] == NULL || argv[2] == NULL)
	{
		printf("INFILE OR OUTFILE NOT SPECIFIED\n");
		return 0;
	}
	strcpy(infile, argv[1]);
	strcpy(outfile, argv[2]);
	
	/* ERROR CHECK */
	if(argv[3] == NULL || argv[4] == NULL || argv[5] == NULL || argv[6] == NULL )
	{
		printf("INSUFFICIENT VALUES ENTERED\n");
		return 0;
	}
	
	
	startx = atoi(argv[3]);
		
	starty = atoi(argv[4]);

	newwidth = atoi(argv[5]);
		
	newheight = atoi(argv[6]);
			
	
		
		
	binary = fopen(infile, "rb");
	
	if( binary == 0)
	{
		printf("File not found!\n");
		return 0;
	}

	
	fread(&w, sizeof(int), 1, binary);
	fread(&h, sizeof(int), 1, binary);
	
	
	/* EXITS IF THE RANGE ENTERED IS OUT OF BOUNDS */
	if (newwidth > w || newheight > h || newwidth < 0 || newheight < 0 || startx > w || starty > h || startx < 0 || starty < 0)
	{
		printf("ONE OF THE RANGE VALUES ENTERED IS OUT OF BOUNDS, PROGRAM WILL NOW EXIT!\n");
		fclose(binary);
		return 0;
	}
	
	
	temp = initSimp(w,h);
	
	copyImage(&temp, binary);
	
	fclose(binary);
	
	/*CROPPING IS DONE HERE */
	newSimp = initSimp(newwidth, newheight);

	
	/* COPIES THE pixels that are cropped out to a new simp file */
	for(i = starty; i < starty + newheight; i++)
	{
		for(j = startx; j < startx + newwidth; j++)
		{
			newSimp.pixArray[i-starty][j-startx] = temp.pixArray[i][j] ;
		}
	}

	
	writeBinary(outfile, &newSimp);
	
	/* FREES THE TEMP IMAGE */
	freeSimp(&temp);
		
	/* FREES THE NEW IMAGE */
	freeSimp(&newSimp);
	
	return 0;
}