hmm i made a small program and tryed it out
it works but not with bigger numbers
i did it like this:
Code:
#include <iostream.h>
#include <string.h>
#include <stdio.h>
void main( void )
{
int ch = ':';
char string[] = "PL";
char *pdest;
int tal;
int x=47;
int y=65;
int *px=&x;
int *py=&y;
int klon=':';
int *k=&klon;
int result;
char buffer[]="1234567890123456789";
cout<<"string before "<<string<<"\n";
strcat(string,(char(*))k);
strcat(string,(char(*))px);
strcat(string,(char(*))k);
strcat(string,(char(*))py);
cout<<"string after "<<string;
pdest= strchr(string,ch);
result=pdest-string+1;
tal=strlen(string);
tal=tal-result;
cout<<"\nfound "<<*pdest<<" at position "<<" "<<result<<" with "<<tal<<" positions remaining";
cout<<"\nx is "<<(int)string[result];
strcpy(buffer,string);
cout<<"\n this is buffer "<<buffer;
pdest= strrchr( string, ch );
result=pdest-string+1;
tal=strlen(string);
tal=tal-result;
cout<<"\nfound next "<<*pdest<<" at position "<<" "<<result<<" with "<<tal<<" positions remaining";
strcpy(buffer,pdest+1);
cout<<"\ny is "<<(int)buffer[result];
///the output is PL:xpos:ypos as i said i used the : to seperate them
}
does anyone know of a better way
ps maybe i did wrong to post this in this forum can a mod pls
move it to the networkforum if its in the wrong one..