I have a small problem. I am a begginer in C programming . I need so help please.
my project i am working on is in image. I use a camera to take a number in very small part for example ( 0901) but sometime those component have defect next to the number therefore is the number will come with (??09?01??).
I do not unknow if my code is good .the number is stored in the folder below.
but I would like help how can I make it just to take 4 number only without (?)also should i need only retur 0 if the number exist and 1 if the number is bigger than 4 ?
#include "stdafx.h"
#include <stdio.h>
#include <string.h>
int main()
{
FILE*fp;
fp=fopen("C:\\Users\\Noy\\Desktop\\tet.txt","w");
char buf[10];
int i;
char *foo = "12?12??34";
int l = strlen(foo);
if(fp !=NULL)
{
for(i=0;i<l;i++)
{
if(*foo=='?')
buf[i] = ' ';
else
buf[i] = *foo;
*foo++;
}
for(i=0;i<l;i++)
fprintf(fp,"%c",buf[i]);
fclose(fp);
}
return 0;
}