I m trying to convert C code to C++. Facing some difficulties help me out!

//This is struct

typedef struct index
  int id;
  char word[20];
  int  count;

// Function prototype

void fileScanner(FILE * ifp,int i);
void fileRead(FILE *ofp);
int  findString(char s[],char u[]);
int searchEntry(indexs [],char key[],int n);
void StoreIndexInFile(FILE *);  // <---is this correct?
void fileDisplay(FILE *ifp,FILE *ofp);

// Function to be called

void StoreIndexInFile(FILE *ifp,indexs ind[],int n)
   indexs *i;
   fprintf(ifp,"\nid word(root)   frequency\n\n");
    fprintf(ifp,"%d %-20s %d \n",i->id,i->word,i->count);

How can I call this function(with parameters)?

3 Years
Discussion Span
Last Post by Schol-R-LEA

I think you'll need to clarify things a bit before anyone can give you a helpful answer. Is your question about how you would call this function in general, or specifically about the difference between calling it in C and calling it in C++? I ask because, in most cases, there wouldn't be a significant difference - though the function itself would probably be defined differently, using an ofstream rather than a FILE, and you could redefine the index structure (or more likely, class) using string objects, but that's a different question altogether.

If you need help understanding how functions are called in general, this post should help explain the relationship between functions, function prototypes, and function calls.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.