the file is serial.c
i compile it using gcc -o serial serial.c
no messages occur and i have a file called serial put into the dir
i've tried just typing it in as 'serial' with no luck. i've been googling with still no answer past the compile part.
#include <stdio.h>
#include <stdlib.h>
int main(int argc,char **argv)
{
char buffer[64];
char strFile[16] = "NodeData(0).dat";
double *M;
double *MV;
double *V;
FILE *fptr;
int c=0,r=0;
int iDim = 0;
int iNumOfNode = 0;
// Get the vector and matrix from the file
if((fptr = fopen(strFile,"r")) == NULL)
{
printf("Error reading from data file %s.",strFile);
exit(1);
}
// Get the dimension and number of nodes from the file
iDim = atoi(fgets(buffer,64,fptr));
iNumOfNode = atoi(fgets(buffer,64,fptr));
// Allocate space for vectors and matrix
M = malloc(iDim * iDim * sizeof(double));
MV = malloc(iDim * sizeof(double));
V = malloc(iDim * sizeof(double));
// Read in vector information
for(r=0;r<iDim;r++)
V[r] = atof(fgets(buffer,64,fptr));
// Read in matrix information
for(c=0;c<(iDim*iDim);c++)
M[c] = atof(fgets(buffer,64,fptr));
// Close file
fclose(fptr);
// Calculate M*V using single processor
for(r=0; r<iDim; r++)
{
MV[r] = 0;
for(c=0; c<iDim; c++)
MV[r] = MV[r] + M[(r * iDim) + c] * V[c];
}
for(r=0; r<iDim; r++)
printf("%lf\n",MV[r]);
// Free memory reserved and set pointers to null
free(M);
free(MV);
free(V);
M = MV = V = NULL;
return 0;
}











