[CODE=c]char start=0;
char isfloat=0;
char tmp_num[10];
int i=0,j=0;
char *end;
memset(tmp_num, 0,10);
end=(*str)+strl en(*str);
while(((*str)++ )<=end)
{
if( isdigit(**str) )
{
start=1;
tmp_num[j] = **str;
j=j+1;
}
if( ispunct(**str) && start==1)
{
isfloat=1;
tmp_num[j] = **str;
j=j+1;
}
if( (**str==' ') || (**str==0) )
{
if(isfloat==1 && start==1)
{
*d=atof(tmp_num );
return 0;
}
if(*(*str+1)==0 )
{
return 1;
}
start=0;
isfloat=0;
j=0;
memset(tmp_num, 0,10);
}
}
return 1;
}[/CODE]
I have large data sets and this functios creates problems because of the isdigit and ispunct function. Do you have any idea to replace them??
Thnx guys!!
char isfloat=0;
char tmp_num[10];
int i=0,j=0;
char *end;
memset(tmp_num, 0,10);
end=(*str)+strl en(*str);
while(((*str)++ )<=end)
{
if( isdigit(**str) )
{
start=1;
tmp_num[j] = **str;
j=j+1;
}
if( ispunct(**str) && start==1)
{
isfloat=1;
tmp_num[j] = **str;
j=j+1;
}
if( (**str==' ') || (**str==0) )
{
if(isfloat==1 && start==1)
{
*d=atof(tmp_num );
return 0;
}
if(*(*str+1)==0 )
{
return 1;
}
start=0;
isfloat=0;
j=0;
memset(tmp_num, 0,10);
}
}
return 1;
}[/CODE]
I have large data sets and this functios creates problems because of the isdigit and ispunct function. Do you have any idea to replace them??
Thnx guys!!
Comment