UtahJ
03-12-2004, 10:31 AM
Hello all... I'm a long time VB programmer who has been
thrown into a C program since I'm the only programmer left
at the company. :(
Anyway... The program is quite large, so I can't post all
of the code, but I have a string similar to "8x60" or "10x60".
I need to return either the 8 or the 10, and the 60.
I have successfully located the "x" using the following:
char str[] = "x";
int location;
char *pdest
fgets(s,7,ordfile_ptr);
pdest = strstr( s, str );
location = pdest - s + 1;
Again, this is only a fraction of the code I'm dealing with...
In VB I would use the Left, Right, and Mid funtions to extract
the "8", "10", or "60", based on the location of "x".
I have read that strings are treated as arrays in C. How
can I extract my information?
Thanks!
thrown into a C program since I'm the only programmer left
at the company. :(
Anyway... The program is quite large, so I can't post all
of the code, but I have a string similar to "8x60" or "10x60".
I need to return either the 8 or the 10, and the 60.
I have successfully located the "x" using the following:
char str[] = "x";
int location;
char *pdest
fgets(s,7,ordfile_ptr);
pdest = strstr( s, str );
location = pdest - s + 1;
Again, this is only a fraction of the code I'm dealing with...
In VB I would use the Left, Right, and Mid funtions to extract
the "8", "10", or "60", based on the location of "x".
I have read that strings are treated as arrays in C. How
can I extract my information?
Thanks!