J
Josh Wilson
Hey gang,
So I have my stdin which is user defined file, and am wanting to write
it to a temporary file (seems odd I know, but there is a sincere
reason), and then use that file as the stdin for the remaining part of
the program. I have combed the FAQ and got some preliminary questions
answered, and tried to model this after what I have seen suggested to
people previously, but for my strcpy and freopen I get,
"warning: passing arg 1 of `strcpy' from incompatible pointer type"
and
"warning: passing arg 1 of `freopen' from incompatible pointer type".
#include <stdio.h>
#include <string.h>
FILE *tempfile;
char s[L_tmpnam];
strcpy(tempfile, tmpnam(s));
/*tempfile = stdout; */
do{
. . .
for (i=0;i<istat;i++) floatarray = (float) dfloatarray;
iostat = fwrite(floatarray,4,istat,tempfile);
if (iostat != istat) fprintf(stderr, "Failed on writing to temporary
file.");
} while(feof(stdin) == 0);
freopen(tempfile,"r",stdin);
But it doesn't have a problem w/ tempfile as arg 4 of fwrite? As you
can see, I have tried setting the tempfil as stdout, but that doesn't
change my error message. Any thoughts? Thanks as always!
JMW
So I have my stdin which is user defined file, and am wanting to write
it to a temporary file (seems odd I know, but there is a sincere
reason), and then use that file as the stdin for the remaining part of
the program. I have combed the FAQ and got some preliminary questions
answered, and tried to model this after what I have seen suggested to
people previously, but for my strcpy and freopen I get,
"warning: passing arg 1 of `strcpy' from incompatible pointer type"
and
"warning: passing arg 1 of `freopen' from incompatible pointer type".
#include <stdio.h>
#include <string.h>
FILE *tempfile;
char s[L_tmpnam];
strcpy(tempfile, tmpnam(s));
/*tempfile = stdout; */
do{
. . .
for (i=0;i<istat;i++) floatarray = (float) dfloatarray;
iostat = fwrite(floatarray,4,istat,tempfile);
if (iostat != istat) fprintf(stderr, "Failed on writing to temporary
file.");
} while(feof(stdin) == 0);
freopen(tempfile,"r",stdin);
But it doesn't have a problem w/ tempfile as arg 4 of fwrite? As you
can see, I have tried setting the tempfil as stdout, but that doesn't
change my error message. Any thoughts? Thanks as always!
JMW