I am writing a program for opengl that converts a file of 0 and 1 to the hex format. If you know about opengl it is going to be for stippled polygons. I am going to convert them to integers first, then hex. Here is what I have. I don't have a compile to check. but is this an efficient way of doing this? and will it work?[EDIT]This is for my own use and I will assume I wrote the file in a square that is a multiple of 8[/EDIT]Code:#include <stdio.h> int bin2dec(char *dec); int main(void){ FILE *infile; int retval; char buffer[8]={0}; /*0-7 + '\0'*/ infile=fopen(argv[1],"rb"); while(fread(buffer,sizeof buffer,1,infile)!=NULL){ retval=bin2dec(buffer); /*rest of code*/ } return 0; } int bin2dec(char *dec){ int x=0, temp,total=0; while(dec[x]!='\0' || dec[x]!='\n'){ if(dec[x]=='1'){ temp=pow(x,2); total+=temp; x++; } if(dec[x]=='0'){ continue; } } }