Can anyone sovle there errors for me, I am new to C programming and I just can solve them for the code below.
Compiling...
cscript.cpp
c:\program files\microsoft visual studio\myprojects\probing jet function\cscript.cpp(4) : error C2015: too many characters in constant
c:\program files\microsoft visual studio\myprojects\probing jet function\cscript.cpp(4) : error C2006: #include expected a filename, found 'constant'
c:\program files\microsoft visual studio\myprojects\probing jet function\cscript.cpp(31) : fatal error C1020: unexpected #endif
Error executing cl.exe.
cscript.obj - 3 error(s), 0 warning(s)
//Start of programming//
// AplCompare.cpp : Defines the entry point for the console aplication.
//
#include 'stdafx.h'
// AplCompare.cpp : Defines the entry point for the console aplication.
//
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#define _WIN32_WINNT 0x0400
#define _ATL_FREE_THREADED
#define _CONVERSION_USES_THREAD_LOCALE
#define _ATL_DLL_IMPL
//#define _ATL_DEBUG_QI
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override
//something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <atlctl.h>
#include <statreg.h>
//#if !defined(AFX_STDAFX_H-1DCOD17B_3DE6_4757_A80D_DF3D8ECC34F5_INCLUDED_)
//#define AFX_STDAFX_H_1FCOD17B_3DE6_4757_A80D_DF3D8ECC34F5_ INCLUDED_ //
//#if _MSC_VER >1000 //
#pragma once //
#endif //_MSC_VER > 1000 //
//#include <stdio.h> //
//#include <string.h> //
//#include <math.h> //
//
//
//
#endif//
typedef struct { /*_aplDataRec is an alias for the structure*/
char token[40];
double value;
}_aplDataRec;
typedef struct{
char token[40];
double aplvalue;
double goldenValue;
}_aplDifferenceRec;
#define Max_APL_RECS 1000
#define MAX_DIFF_RECS MAX_APL_RECS
#define VERY_SMALL_NUMBER 1.0e-6
#define APL 1
#define GOLDEN 2
#define TRUE 1
#define FALSE 0
_aplDataRec apl[MAX_APL_RECS], golden[MAX_APL_RECS];
int numAplRecs = 0, numGoldenRecs = 0;
_aplDifferenceRec difference[MAX_DIFF_RECS];
int numDifferences = 0;
void addAplRec(char *token, double value )
{
if(numAplRecs < MAX_APL_RECS)
{
strcpy(apl[numAplRecs].token, token);
apl[numAplRecs].value =value;
numAplRecs++;
}
}
void addGoldenRec(char *token, double value)
{
if (numGoldenRecs < MAX_APL_RECS)
{
strcpy(golden[numGoldenRecs].token, token);
golden[numGoldenRecs].value = value;
numGoldenRecs++;
}
}
void addDifferenceRec(char *token, double, double aplValue, double goldenValue)
{
if (numDifferences < MAX_DIFF_RECS)
{
strcpy(difference[numDifferences].token, token);
difference[numdifferences].aplvalue = aplvalue;
difference[numDifferences].goldenValue = goldenValue;
numDifferences++;
}
}
int readFile(char *filename, int APL_OR_GOLDEN)
{
char line[256];
FILE *fd;
fd =fopen(filename,"r");
if (fd==NULL)
{
printf("File <%s> Not Accessible !\n", fileName);
return(-2);
}
while (!feof(fd) && (line==fgets(line,sizeof(line)-1,fd)))
{
char *p, token[40];
double value;
int itemsRead;
line[strlen(line)-1] = '\0'; /* strip off the line ffeed character at the end*/
for (p=line; (*p!=',') && (*p!'\0'); p++);
if (*p ==',');
{
*p = '\0';
strcpy(token, line); /*token is everthing before the comma*/
itemsRead = sscanf(p+1, "%lg",&value); /* Value is whatever's after the comma*/
if (itemsRead==0) value = 0.0; /* or zero if there's nothing after the comma.*/
if (strcmp(token, "WAFERNAME") !=0) /*skip this token, as the values will ALWAYS differ!*/
/* The 'value' for this token contains the PRODUCT name.*/
{
if (APL_OR_GOLDEN ==GOLDEN)
{
addGoldenRec(token, value);
}
else
{
addAplRec(token, value);
}
}
}
}
fclose(fd);
return(0);
}
int compareAplGolden()
{
int i,j;
_aplDataRec *p, *q;
for (i=0, p=golden; i<numGoldenRecs; i++,p++)
{
for (j=0, q=apl; j<numAplRecs; j++, q++)
{
if (strcmp(p->token, q->token) == 0)
{
if (fabs(p->value - q->value) > VERY_SMALL NUMBER)
{
addDifferenceRec(p->token, p->value, q->value);
}
}
}
}
if (numAplRecs != numGoldenRecs) return(-1); /* Immediate disqualification */
else if (numDifference>0) return(-2); /* One or more differences logged */
return(0); /* Files match */
}
int main(int argc, char* argv[])
{
int i, status;
if (argc<3)
{
printf("usage: Aplcompare <goldenFile> <aplFile !!\n");
return(-1);
}
status = readFile(argv[1], GOLDEN); if (status!=0) return status;
status = readFile(argv[2], APL); if (status!=0) return status;
if (compareAplGolden() ==0)
{
printf("Files Match!\n");
}
else
{
printf("Files Are Different! Differences are as follows\n\n");
for (i=0; i<numDifferences; i++)
{
printf("Token: %s APL Value: %lg GOLDEN Value: %lg\n",
difference[i].token, difference[i].aplValue, difference[i].goldenValue);
}
}
return(0);
}
typedef struct { /*_aplDataRec is an alias for the structure*/
char token[40];
double value;
}_aplDataRec;
typedef struct{
char token[40];
double aplvalue;
double goldenValue;
}_aplDifferenceRec;
#define Max_APL_RECS 1000
#define MAX_DIFF_RECS MAX_APL_RECS
#define VERY_SMALL_NUMBER 1.0e-6
#define APL 1
#define GOLDEN 2
#define TRUE 1
#define FALSE 0
_aplDataRec apl[MAX_APL_RECS], golden[MAX_APL_RECS];
int numAplRecs = 0, numGoldenRecs = 0;
_aplDifferenceRec difference[MAX_DIFF_RECS];
int numDifferences = 0;
void addAplRec(char *token, double value )
{
if(numAplRecs < MAX_APL_RECS)
{
strcpy(apl[numAplRecs].token, token);
apl[numAplRecs].value =value;
numAplRecs++;
}
}
void addGoldenRec(char *token, double value)
{
if (numGoldenRecs < MAX_APL_RECS)
{
strcpy(golden[numGoldenRecs].token, token);
golden[numGoldenRecs].value = value;
numGoldenRecs++;
}
}
void addDifferenceRec(char *token, double, double aplValue, double goldenValue)
{
if (numDifferences < MAX_DIFF_RECS)
{
strcpy(difference[numDifferences].token, token);
difference[numdifferences].aplvalue = aplvalue;
difference[numDifferences].goldenValue = goldenValue;
numDifferences++;
}
}
int readFile(char *filename, int APL_OR_GOLDEN)
{
char line[256];
FILE *fd;
fd =fopen(filename,"r");
if (fd==NULL)
{
printf("File <%s> Not Accessible !\n", fileName);
return(-2);
}
while (!feof(fd) && (line==fgets(line,sizeof(line)-1,fd)))
{
char *p, token[40];
double value;
int itemsRead;
line[strlen(line)-1] = '\0'; /* strip off the line ffeed character at the end*/
for (p=line; (*p!=',') && (*p!'\0'); p++);
if (*p ==',');
{
*p = '\0';
strcpy(token, line); /*token is everthing before the comma*/
itemsRead = sscanf(p+1, "%lg",&value); /* Value is whatever's after the comma*/
if (itemsRead==0) value = 0.0; /* or zero if there's nothing after the comma.*/
if (strcmp(token, "WAFERNAME") !=0) /*skip this token, as the values will ALWAYS differ!*/
/* The 'value' for this token contains the PRODUCT name.*/
{
if (APL_OR_GOLDEN ==GOLDEN)
{
addGoldenRec(token, value);
}
else
{
addAplRec(token, value);
}
}
}
}
fclose(fd);
return(0);
}
int compareAplGolden()
{
int i,j;
_aplDataRec *p, *q;
for (i=0, p=golden; i<numGoldenRecs; i++,p++)
{
for (j=0, q=apl; j<numAplRecs; j++, q++)
{
if (strcmp(p->token, q->token) == 0)
{
if (fabs(p->value - q->value) > VERY_SMALL NUMBER)
{
addDifferenceRec(p->token, p->value, q->value);
}
}
}
}
if (numAplRecs != numGoldenRecs) return(-1); /* Immediate disqualification */
else if (numDifference>0) return(-2); /* One or more differences logged */
return(0); /* Files match */
}
int main(int argc, char* argv[])
{
int i, status;
if (argc<3)
{
printf("usage: Aplcompare <goldenFile> <aplFile !!\n");
return(-1);
}
status = readFile(argv[1], GOLDEN); if (status!=0) return status;
status = readFile(argv[2], APL); if (status!=0) return status;
if (compareAplGolden() ==0)
{
printf("Files Match!\n");
}
else
{
printf("Files Are Different! Differences are as follows\n\n");
for (i=0; i<numDifferences; i++)
{
printf("Token: %s APL Value: %lg GOLDEN Value: %lg\n",
difference[i].token, difference[i].aplValue, difference[i].goldenValue);
}
}
return(0);
}