Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: lbucko
  • Order by date
  1. lbucko

    Passing text from a file to an array??

    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...
  2. lbucko

    Printing from an array of type struct

    Not just homework rwb1959...unfortunatly! Thanks for the input anyway!
  3. lbucko

    Printing from an array of type struct

    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...
  4. lbucko

    Arrays & selection_sort

    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...
  5. lbucko

    Storing a result in a 2D array

    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) {...
  6. lbucko

    How to comape tokenised strings??

    Thanks Leibnitz, that worked alright but I'm still a bit puzzeled as how to manage queries with more than one word. can I index the individual words in the string in some way?? I was trying to add another while loop inside the following loop, while( string[i] != '\0') { tolower(...
  7. lbucko

    How to comape tokenised strings??

    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...
  8. lbucko

    I have a function from which I need

    I thought I wouldn't be able to return an array like that, full code for the functionn is as follows: int merge(Res results[][100], int num_sites) { int index[NUM_SITES]; //index array of sites returned int res_arr[500];//overall results array const num_site=0; int...
  9. lbucko

    I have a function from which I need

    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...
  10. lbucko

    Merging n sorted arrays

    I realise that however I need create a sorted array of n arrays, is that the only way I can merge them
  11. lbucko

    Merging n sorted arrays

    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]) {...

Part and Inventory Search

Back
Top