File open compilation error

Asked 2 years ago, Updated 2 years ago, 116 views

When opening the c++ file, an error occurred in the line number below.
There were 12 errors, but I couldn't solve them.
I would appreciate it if you could give me your knowledge.

/****************/
/*   Main Routine*/
/* ****************** */
void main (void)
{
 FILE*fi,*fo;
 int sou, i, j, mode;
 float dat;
 long learn;

 while(1){
  mode = mode_sel();      
  if(mode==3)break;
  printf("\x1b*");      
  sou = junbi(mode);      
  if(mode==1)
    printf("\nPlease enter a data filename:");
  if(mode==2)
    printf("\nPlease enter a filename:");  

72fi = openfile("rt", AGAIN);

    fscanf(fi, "%d", & account);    
for(i=0;i<icount;i++){
   for(j=0;j<node[0];j++){
    fscanf(fi, "%f", & dat);
      ind [node[0]*i+j] = dat;
   }
  }
  fclose(fi);
  if(mode!=2){
   printf("Please enter a data file name:");
                                            
84 fo = openfile("rt", AGAIN);


voidomomi(intsou)
{
 FILE*wfi;
 challenge [20];
 inti,j,n;
 printf("Do you want to use existing data? (y/n):");
 if(hityn()==YES){
  printf("File Name:");   

147 wfi = openfile("rt", AGAIN);


void neu_cal(int saw, long learn)
{
 FILE*fe;
 intyn, wmode, i, j, next;
 float averr, outerr [20];
 long kai;
 kai = 1L;                      
 wmode=w_ren_mode();
 printf("\nDo you want to print the error to the file? (y/n):");
 if((yn=hityn())==YES){
  printf("Please enter the output error filename:");

181fe=openfile("wt", AGAIN);



void wf_write(intsou)
{
 FILE*wfo;
 inti,j,n;
 printf("\nPlease enter the output filename:");

413 wfo = openfile("wt", AGAIN);



/* ******************** */
/*  Open File*/
/* ******************** */
FILE* openfile(int*mode, intsw)
{
  charfn [25];
 FILE*fp;
 while(1){
  scanf("%s",fn);

487 if((fp=fopen(fn,mode)))==NULL){

    printf("%s could not be opened.\n", fn);
   if(sw==EXIT)exit(1);
    printf("Please re-enter the file name:");
  } else {
     break;
  }
 }
 return(fp);
}

[Error indication] 12 Errors

Error (active) E0304 An instance of overloaded function "openfile" does not match the argument list*.CPP72  
Error (active) E0304 Instance of overloaded function "openfile" does not match argument list*.CPP84
Error (active) E0304 Instance of overloaded function "openfile" does not match argument list*.CPP147
Error (active) E0304 Instance of overloaded function "openfile" does not match argument list*.CPP181
Error (active) E0304 Instance of overloaded function "openfile" does not match argument list*.CPP413
Error (active) Argument for type E0167 "int*" is incompatible with parameter of type "const char*".CPP487 

Error C2664 'FILE* openfile(char*, int)': Cannot convert argument 1 from 'const char[3]' to 'char*'. *.CPP72  
Error C2664 'FILE* openfile(char*, int)': Cannot convert argument 1 from 'const char[3]' to 'char*'. *.CPP84
Error C2664 'FILE* openfile(char*, int)': Cannot convert argument 1 from 'const char[3]' to 'char*'. *.CPP147
Error C2664 'FILE* openfile(char*, int)': Cannot convert argument 1 from 'const char[3]' to 'char*'. *.CPP181
Error C2664 'FILE* openfile(char*, int)': Cannot convert argument 1 from 'const char[3]' to 'char*'. *.CPP413 
Error C2664 'FILE*fopen(const char*, const char*)': Cannot convert argument 2 from 'int*' to 'const char*'.    *.CPP487 

c++ c visual-c++

2022-09-30 17:51

2 Answers

The argument for the function called openfile is inconsistent with the declaration
Let's do something about this


2022-09-30 17:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.