472,952 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

error C2664: 'parseInput' : cannot convert parameter 2 WHY?

I have no idea why am I getting an error C2664: 'parseInput' : cannot convert parameter 2 from 'main::WORD_STRUCT [200]' to 'struct WORD_STRUCT []'

Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  5. #define FILENAME 80
  6. #define MAX_SIZE 1000
  7. #define CHAR_SIZE 200
  8. #define FLUSH while(getchar() != '\n')
  11. // Prototype Declarations
  12. int getFileName (char nameStr[]);
  13. int parseInput( char tempStr[], struct WORD_STRUCT structAry[]);
  15. int main (void)
  16. {
  17. //    Local Definitions
  18.     FILE *inFile;
  19.     int numElems;
  20.     int nameSize;    
  21.     int i;
  22.     char nameStr [FILENAME];
  23.     char originalStr[MAX_SIZE];
  24.     char tempStr[MAX_SIZE];
  25.     char *pArray [CHAR_SIZE];
  27.     typedef struct {
  28.     char *word;
  29.     int count;
  30.     } WORD_STRUCT;
  33.     typedef struct nodeStruct {
  34.     WORD_STRUCT data;    /* can be any type */
  35.     struct nodeStruct *next; /* points to the next 
  36.                                 node */
  37.     } NODE;
  39.     WORD_STRUCT structAry[CHAR_SIZE];
  41. //    Statements
  42.     printf("Beginning of Program.\n");
  44.     if (!(inFile = fopen (nameStr, "r")))
  45.         {
  46.          printf("Error opening %s for reading\n", nameStr);// Prints Error if cannot find file
  47.          exit (100); // Quit if cannot find file
  48.         } // if open input 
  50.      while(fgets ( tempStr , MAX_SIZE , inFile)!=NULL);
  51.     {
  52.     parseInput(tempStr, structAry); // This is where I am getting the ERROR
  53.     }
  54.  return 0;
  55. }
Any help would be great
Jun 25 '07 #1
1 3380
9,208 Expert Mod 8TB
Your typedef for WORD_STRUCT comes after the function prototype of your parseInput() function and WORD_STRUCT is a type so you need to remove the struct qualifier from the function argument. Here's what I did. Compiles fine.
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  5. #define FILENAME 80
  6. #define MAX_SIZE 1000
  7. #define CHAR_SIZE 200
  8. #define FLUSH while(getchar() != '\n')
  9.  typedef struct {
  10.     char *word;
  11.     int count;
  12.     } WORD_STRUCT;
  14. // Prototype Declarations
  15. int getFileName (char nameStr[]);
  16. int parseInput( char tempStr[], WORD_STRUCT structAry[]);
  18. int main (void)
  19. {
  20. //  Local Definitions
  21.     FILE *inFile;
  22.     int numElems;
  23. etc....
Jun 26 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

by: John Smith | last post by:
What's wrong with the use of atoi in the following code? Why do I get the error message: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *' char cBuffer; void...
by: Gary | last post by:
I have a strange compile error. C2664 cannot convert parameter 2 from int to int... Earlier in my code I was setting up my dataset... I add an int field like so... ...
by: Steve Wilkinson | last post by:
I've just started using managed C++ with VS2005, so please forgive my ignorance. I'm investigating producing a managed wrapper for some functionality of the Windows Media Format SDK. I have the...
by: kaizen | last post by:
Hi, i wrote the code in C and compiled in VC++ compiler. at that time it has thrown the below mentioned error. error C2664: 'strcpy' : cannot convert parameter 2 from 'char' to 'const char *'...
by: DukeRock | last post by:
This is the function I'm getting the error on: S32 GuiAviBitmapCtrl::fileOpen() { S32 rval; if (!dStrcmp(mAviFilename,"")) return MOVERR_NOVIDEOSTREAM; rval =...
by: stillh2os | last post by:
Hello. I'm new to .NET, and I'm trying to implement a callback function. I want my managed C++ code to call an unmanaged function, passing in a callback function that the unmanaged C/C++ code...
by: asenthil | last post by:
Hai this is senthil... I had tried to write a string which fetched from a database. into a file... when i tried to compile the solution the following error occurs like this error C2664:...
by: =?Utf-8?B?V2hpdG5leSBLZXc=?= | last post by:
Hi there, I'm having a bit of trouble using an HRASCONN object as a class member variable inside my managed C++ class. When I call RasDial() and pass in the address of my HRASCONN object, I get...
by: slizorn | last post by:
well the error i get is the title above: error C2664: 'searchTree' : cannot convert parameter 2 from 'const char *' to 'char' error is form this line searchTree(treeObj->root ,data1.c_str());...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.