char hello[]= "main(int";
How can i extract the "int" from the hello string??
I know the length of the string which is 8 and i know that the "(" start in position 5. From there, how can i proceed in getting the rest of the character after the "(" ??
This is a discussion on Getting string after certain character within the C Programming forums, part of the General Programming Boards category; char hello[]= "main(int"; How can i extract the "int" from the hello string?? I know the length of the string ...
char hello[]= "main(int";
How can i extract the "int" from the hello string??
I know the length of the string which is 8 and i know that the "(" start in position 5. From there, how can i proceed in getting the rest of the character after the "(" ??
If you know it's at a given position, then do:
That's one way to do it. Another way would be to simply loop through checking each character until you found what you're looking for, and then go from there. You could use the standard string functions to aid you. There are lots of ways to do it.Code:#define OFFSET 5 /* or whatever it is */ char hello[] = "main(int"; char *ptr = hello + OFFSET; printf("%s", ptr );
Quzah.
Hope is the first step on the road to disappointment.