Hi,
I have an array of structs, comprising the name of an application and the path
struct{
char name[50];
char path[1024];
}
I am trying to write a function to search this and build a sub set based on the search string.
Eg, If the search string is "Fi"
Then it would match from the left hand side only, based on the first two characters
So matching entries would be
Firefox.exe
Findfast.exe
for example
My biggest hurdle is my abysmal knowledge of string slicing functions and string comparison functions in C, and my googling efforts have been confusing at best.
Here is the skeleton of the function
can anyone post some code to steer me in the right direction?
Charlie Benger-Stevenson
Hart Hill IT Ltd
I have an array of structs, comprising the name of an application and the path
struct{
char name[50];
char path[1024];
}
I am trying to write a function to search this and build a sub set based on the search string.
Eg, If the search string is "Fi"
Then it would match from the left hand side only, based on the first two characters
So matching entries would be
Firefox.exe
Findfast.exe
for example
My biggest hurdle is my abysmal knowledge of string slicing functions and string comparison functions in C, and my googling efforts have been confusing at best.
Here is the skeleton of the function
Code:
void filterEnumeratedPrograms(char * searchString)
{
int i=0;
int length=0;
length = strlen(searchString);
printf("Search string %s is %d characters long \n", searchString,length);
for (i=0;i<lNumPrograms;i++)
{
//comparison goes here
}
}
can anyone post some code to steer me in the right direction?
Charlie Benger-Stevenson
Hart Hill IT Ltd