void main( int argc, char * argv[] ) { char str[] = "This is the string to search" ; char lookfor = 's' ; int result ; result = charpos( str, lookfor ) ; printf( "Character appears at %d\n", result ) ; lookfor = 'q' ; result = charpos( str, lookfor ) ; printf( "Character appears at %d\n", result ) ; }
int string2pixmap(char* str, Pixmap *p) { int x; XCopyArea(DADisplay, blank_buf, *p, gc, 0,0, 42, 8, 0, 0); for (x = 0; x < strlen(str); x++) { XCopyArea(DADisplay, char_buf, *p, gc, charpos(str[x]),0, 6, 8, x*6, 0); } }
int parse_value(char *str, char *delimiters) { int len; char *end; parse_spaces(); end=iparser; while ( !charpos(*end,delimiters) && (*end!=0) ) end++; if ( (len=end-iparser)>0 ) { if (len>=255) len=255; // check for length memcpy(str, iparser, len); iparser = end; } str[len] = 0; return len; }
Z I formed_group(C c){S s="\n \\/\"";R charpos(s,c);} //could be table-lookup instead