Foros del Web » Programación para mayores de 30 ;) » C/C++ »

como funciona este programa para mandar una imagen al cmd bit pot bit

Estas en el tema de como funciona este programa para mandar una imagen al cmd bit pot bit en el foro de C/C++ en Foros del Web. #include <cstdlib> #include <stdio.h> #include <fstream> #include <vector> #include <iostream> #include <boost/algorithm/string.hpp> using namespace std; using namespace boost; int main(int argc, char** argv) { ifstream ...
  #1 (permalink)  
Antiguo 16/02/2012, 15:06
 
Fecha de Ingreso: febrero-2012
Mensajes: 1
Antigüedad: 12 años, 2 meses
Puntos: 0
Pregunta como funciona este programa para mandar una imagen al cmd bit pot bit

#include <cstdlib>
#include <stdio.h>
#include <fstream>
#include <vector>
#include <iostream>
#include <boost/algorithm/string.hpp>

using namespace std;
using namespace boost;

int main(int argc, char** argv) {
ifstream file("C:/home/shk/circles.xbm", ios_base::in | ios_base::binary);

file.seekg(0, ios::end);
int len = file.tellg();
file.seekg(0, ios::beg);
char* s = new char[len];
file.read(s, len);

//
// Here file data
//
string line(s);

size_t pos_brace1 = line.find("{");
size_t pos_brace2 = line.find("}");
string str2 = line.substr ((int)pos_brace1 + 1, (int)pos_brace2);

//
// trim string
//
trim(str2);

//
// Delete }; at the *.xbm end
//
str2.erase(str2.length() - 2);

//
// Split string by ', '
// PixelVector - dynamic array with pixels
typedef vector<string> split_vector_type;
split_vector_type PixelVector;
split( PixelVector, str2, is_any_of(", "), token_compress_on );

//
// Width and height parsing
// Example:
// str 3 =
// #define icon_width 16
// #define icon_height 16
// #define icon_x_hot 4
// #define icon_y_hot 4
size_t pos_brace3 = line.find("#define");
size_t pos_brace4 = line.find("static");
string str3 = line.substr ((int)pos_brace3, (int)pos_brace4);

//
// Split #define width
//
split_vector_type PixelVector2;
split( PixelVector2, str3, is_any_of(" \n"), token_compress_on );

//
// vector Parameters - width heigth hot points
//
vector<string> Parameters;
int count = 0;
for (int i = 0; i < PixelVector2.size() - 1; i++){
++count;
if (count == 3){
Parameters.push_back(PixelVector2.at(i));
count = 0;
}
}

file.close();
return 0;
}

Etiquetas: cmd, programa, string
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 21:38.