Help for a very beginner!

Ok guys i want to read an monochromatic .bmp file using dev c++ and then create a file with the X and Y from the images,i'm very newbie in programming and i need some help.
i've done this but i've not got so far.

i put the allegro.h but i still dont know how to use it,if anyone can solve my problem with ou without allegro i would appreciate it.


#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include <allegro.h>

int main ()
{
FILE *entrada,*saida;
entrada=fopen("CCD.bmp","r"); // figure out how to read .bmp
saida=fopen("coordenadas.txt","w");
int i,contx,conty,coordx,coordy;
float aux1,aux2,valor;
contx=0;
conty=0;
coordy=0;
coordx=0;
if (entrada==NULL)
{
printf("ERRO,file not found");
}

for(i=0;i<14;i++){ // figure out how to eliminate the header
aux1=fgetc(entrada);
aux2=fgetc(entrada);
}
aux1=69;
aux2=69;
while(!feof(entrada))
{
aux1=fgetc(entrada);
aux2=fgetc(entrada);
valor=aux1*16+aux2; // convert to HEX
printf("%c",&valor);
if(valor==0){ // figure out the black pixel ( or white) 0 or 255
coordx=contx;
coordy=conty;
fprintf(saida, "\n X: %d Y: %d \n", coordx,coordy);
}
contx++;
if(contx==941)
{
contx=0;
conty++;
}
}
if(feof(entrada))
{
printf("END!!\n");
fclose(entrada);
system("PAUSE");
}
}
Last edited on
Topic archived. No new replies allowed.