Hi, I am a newbie to Visual C++ programming. I already have a code which I edited for my purpose. It is as below.

#include <stdafx.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

#define FIL_LINES 17873    /* no. of lines in input datafile  */
			
double t[FIL_LINES];
double x[FIL_LINES],y[FIL_LINES],z[FIL_LINES];
double vx[FIL_LINES],vy[FIL_LINES],vz[FIL_LINES];
double tke[FIL_LINES],tedr[FIL_LINES];
double out_x[FIL_LINES], out_y[FIL_LINES], out_z[FIL_LINES];
double out_vx[FIL_LINES],out_vy[FIL_LINES],out_vz[FIL_LINES];
double out_temp[FIL_LINES];
double out_tke[FIL_LINES], out_tedr[FIL_LINES];


void main(void);
{
  FILE *fil1;
  int j;
  double a,b,c,d,e,f,g,h,i,vel_fact,temp_fact;

  vel_fact = 1.0; // Factors for scaling to match m-dot and Temp.
  temp_fact = 1.0;

  fil1 = fopen("baseload.dat");
  for (j=0; j<FIL_LINES; j++)
	{
	fscanf(fil1,"%lf %lf %lf %lf %lf %lf %lf %lf\n",&a,&b,&c,&d,&e,&f,&g,&h,&i);
	x[j] = a;
	y[j] = b;
	z[j] = c;
	vx[j] = d;		// Assigning the rows to different parameters
         vy[j] = e;
	vz[j] = f;
	t[j] = g;
	tke[j] = h;
    tedr[j] = i;
	}
  fclose(fil1); 

    for (j=1; j<FIL_LINES; j++)
       {
		out_x[j] = x[j];
		out_y[j] = y[j];
		out_z[j] = z[j];
		out_vx[j] = vel_fact*vx[j];
		out_vy[j] = vel_fact*vy[j];   
		out_vz[j] = vel_fact*vz[j];
		out_temp[j] = temp_fact*t[j];
		out_tke[j] = tke[j];
		out_tedr[j] = tedr[j];
		}
	write_output_data();
  }
 // Call to subroutine to write output file for Fluent
  // End main program

void write_output_data(void);
{
	FILE *fil;
	int j;

	fil = fopen("SGT5_4000F-100%Load.prof","w");
 
	fprintf(fil,"((SGT5_4000F_100pc point %d)\n\n");
  
	fprintf(fil,"(x\n");
	fprintf(fil,"%lf\n",out_x[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n\n");
	}
	fprintf(fil,"(y\n");
	fprintf(fil,"%lf\n",out_y[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n\n");
	}
	fprintf(fil,"(z\n");
	fprintf(fil,"%lf\n",out_z[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n\n");
	}
	fprintf(fil,"(x-velocity\n");
	fprintf(fil,"%lf\n",out_vx[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n\n");
	}
	fprintf(fil,"(y-velocity\n");
	fprintf(fil,"%lf\n",out_vy[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n\n");
	}
	fprintf(fil,"(z-velocity\n");
	fprintf(fil,"%lf\n",out_vz[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n\n");
	}
	fprintf(fil,"(temperature\n");
	fprintf(fil,"%lf\n",out_temp[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n)\n");
	}
	fprintf(fil,"(tke\n");
	fprintf(fil,"%lf\n",out_tke[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n)\n");
	}
         fprintf(fil,"(tedr\n");
	fprintf(fil,"%lf\n",out_tedr[0][0]);
	for (j=1; j<FIL_LINES; j++)
	{
	fprintf(fil,")\n)\n");
	}
	fclose(fil);
}

Here is the description of what I wanted to do. I have an input file, with rows a,b,c,d,e,f,g,h,i which I had to assign to different variables. Then I have this "vel_fact and temp_fact" which I need to multiply to some of the variables and write out the output file as defined.

Errors: error C2447: '{' : missing function header (old-style formal list?)

The above error is seen near the lines where I called the "void main(void);" just after defining the variables and the other one is near "int write_output_data(void);" after the end of main program.

How can I get rid of these two errors? Please help. Its been years since I did any programming.. I really want this to work. To be frank, I really don't know the meaning of some functions in this program... I just want it to work rather than understand it.

Thanks....

Line 19 should be

int main()

instead of

void main(void);

Line 61

void write_output_data()

instead of

void write_output_data(void);

You need to get rid of the semi colon after the function header

void write_output_data(void)

Otherwise the compiler thinks it's a function declaration.

You need to get rid of the semi colon after the function header

void write_output_data(void)

Otherwise the compiler thinks it's a function declaration.

This^^^

Also,

void func_name(void)

is a valid c\c++ construct.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.