Hello,
I have created a function fopen of a FILE *
and build a name.o
name.o :
void Fouverture (char *nomfic, char *typaction, FILE *fh)
{
*FILE *fh;
int rc=0;
fh=fopen(nomfic, typaction);
if (fh == NULL) { rc=1;}
return(rc);
}
Now I am trying to call this function from another
file name1.c, I want to call this function more then one time to open n FILE, and the problem is that when the function returns the FILE it is always NULL.
name1.c :
#include <stdio.h>
#define FICHIERA "txt.txt"
#define MAX 256
void main()
{
char mode_opt[2];
int ret;
FILE *fh;
strcpy(mode_opt,"r"
Fouverture(FICHIERB, mode_opt, &fh);
if (fh == NULL)
{
printf("imposible to open file to
read:<txt1.txt>\n"
exit(1);
}
Ffermeture(fh);
}
I have created a function fopen of a FILE *
and build a name.o
name.o :
void Fouverture (char *nomfic, char *typaction, FILE *fh)
{
*FILE *fh;
int rc=0;
fh=fopen(nomfic, typaction);
if (fh == NULL) { rc=1;}
return(rc);
}
Now I am trying to call this function from another
file name1.c, I want to call this function more then one time to open n FILE, and the problem is that when the function returns the FILE it is always NULL.
name1.c :
#include <stdio.h>
#define FICHIERA "txt.txt"
#define MAX 256
void main()
{
char mode_opt[2];
int ret;
FILE *fh;
strcpy(mode_opt,"r"
Fouverture(FICHIERB, mode_opt, &fh);
if (fh == NULL)
{
printf("imposible to open file to
read:<txt1.txt>\n"
exit(1);
}
Ffermeture(fh);
}