This is the help page from Turbo C/C++ ver. 1:
Code:
strchr Finds c in str.
Syntax:
char *strchr(const char *s, int c);
Prototype in:
string.h
Remarks:
strchr scans a string in the forward direction, looking for a specific
character. strchr finds the first occurrence of the character c in the
string s.
The null-terminator is considered to be part of the string, so that, for
example,
strchr(strs,0)
returns a pointer to the terminating null character of the string strs.
Return Value:
Returns a pointer to the first occurrence of the character c in s. If c does
not occur in s, strchr returns null.
Portability:
strchr is available on UNIX systems and is defined in ANSI C.
Example:
#include <string.h>
#include <stdio.h>
int main(void)
{
char string[15];
char *ptr, c = 'r';
strcpy(string, "This is a string");
ptr = strchr(string, c);
if (ptr)
printf("The character %c is at position: %d\n", c, ptr-string);
else
printf("The character was not found\n");
return 0;
}
I'm assuming you either have an early version of Turbo C/C++, or are thinking of getting it.
For moving the cursor, you can use the non-standard conio.h include file.
Adak