How do I read in text from a file into an array I have tried the following:
while(fgets(phrase, 100, ffp))
but this doesn't seem to work, I want to read in from the a file with file pointer ffp, into array phrase.
I also tried to do it the following way:
int status = fscanf(ffp...
Have two problems, first of all I want to print the values from an array of type struct Res,
struct res {
int doc_id;
float score;
};
typedef struct res Res;
Res results[NUM_SITES][100];//Array I want to print from
I've tried the following but can't seem to get it right...
Is there a select_sort function for sorting arrays, I was told about but don't know how to use it. I want to sort an array according to a score assigned to each element
void smart_2(FILE *file, char *query, Res results[][100])
{
FILE *ffp;
char phrase[100];
Res smrt_res[100];//array to...
How do I return a text string and a numerical value to an array? At the moment I'm just printing them out, code as follows,
while(fgets(fname, 100, file) != NULL)
{
ffp=fopen(fname, " ");
while(fgets(phrase, 100, ffp))
{
if(strstr(phrase, query) != NULL)
{...
I have a file which contains certain text strings. I also have a char array which contains a query string. I have tokenised both strings to take one word at at a time but am unsure as how to compare the tokens to find out if there is a match between them. What I am trying to achieve is to search...
I have a function from which I need to return an array of values but I'm not sure how to go about this, do I need to use some sort of pointers? Some code shown below:
while (index[i]<num_site)
{
max = get_biggest(index, results);
res_arr[index_res++] = results[max][index[max]-1].score...
I need to merge into a single array multiple sorted arrays. I can manage merging two arrays but don't know how to do it for n arrays. Any help would be appreciated. Section of current code shown below:
while ((indexa<num_site1)&&(indexb<num_site2))
{
if (site1[indexa]<= site2[indexb])
{...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.