Its starting to tick me off here's the code.
#include %26lt;stdio.h%26gt;
#include %26lt;stdlib.h%26gt;
#include %26lt;math.h%26gt;
int main()
{
FILE *suture;
float batchnumber, temp, pressure, dwelltime;
/* Execute instructions to solve the problem. */
suture=fopen("suture.dat","r");
if ((suture=fopen(suture,"r"))==NULL)
{printf("Could not open %s.\n", suture); return EXIT_FAILURE;}
while (fscanf(suture,"%lf %lf %lf %lf", %26amp;batchnumber, %26amp;temp, %26amp;pressure, %26amp;dwelltime)==4)
printf("Batch %lf \nTemperature (C) %lf \nPressure(psi)\n Dwell Time %lf\n",
batchnumber, temp, pressure, dwelltime);
return EXIT_SUCCESS;
}
I have a data file named suture.dat that I'm trying to read from and simply have the data from that file display on the screen.
Please Help!!!
OK can someone tell my why I keep getting error C2664 when I try to build my c++ code?
Hello,
The error C2664 involves an incorrect argument type for your second fopen call.
Your code of:
if ((suture=fopen(suture,"r"))==NULL)
{printf("Could not open %s.\n", suture); return EXIT_FAILURE;}
Should be this instead:
if (suture==NULL)
{printf("Could not open suture.dat\n"); return EXIT_FAILURE;}
Please note that I also changed the printf statement in addition to the contents of the if statement. You were trying to pass a FILE* as a string.
Hope this helps.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment