RE: [Dev-C++] copying part of a string to another string?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ya...> - 2001-01-15 09:47:58
|
for(i=0; temp[i]!=0; i++)
{
if(temp[i]>='0' && temp[i]<='9') /* Works with ASCII only */
*(areaptr++)=temp[i]; /* Parentheses are not needed but used because some
compilers
may issue a warning, and i do not like
warnings. */
}
*areaptr='\0';
Ioannis
* Ioannis Vranos
* Programming pages: http://members.nbci.com/noicys
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...]On Behalf Of
> Calvin Mills
> Sent: Monday, January 15, 2001 5:14 AM
> To: Dev-Cpp-Users
> Subject: [Dev-C++] copying part of a string to another string?
>
>
> Hello, I am trying to work an assignment for school, and I am
> having trouble
> copying part of a string to another string. the string is a area
> code that
> includes the () and I am trying to get numbers only from it so I can turn
> them into a int. The code I have tried is below. temp currently
> holds the
> areacode withe the ().
> Any input would be greatly appriceated.
>
> Calvin
>
> for(i=1,x=0;i<4;i++)
> {
> *areaptr = temp[i];
> areaptr++;
> }
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|