Hello… pls help me out to solve this error in Eclispe
Error : a function- definition is not allowed here before ‘{’ token.
Error : expected “}” at end of input
i’ve declared the function before main…
ple let me knw how to solve this …
if (iSaveOutput)
{
char strFileName1[255], strFileName2[255];
strcpy(strFileName1, strEXEName);
strcpy(strFileName2, strEXEName);
char strExecCnt[32];
//itoa(iExecCnt, strExecCnt, 10);
char* inttochar(int iExecCnt, int base)
{
static char strExecCnt[32] = {0};
int i = 30;
for(; iExecCnt && i ; --i, iExecCnt /= base)
strExecCnt = “0123456789abcdef”[iExecCnt % base];
- return &strExecCnt[i+1];*
- }*
- strcat(strFileName1, strExecCnt);*
- strcat(strFileName2, strExecCnt);*
- strcat(strFileName1, “_inputImg.bin”);*
- strcat(strFileName2, "outputImg.bin");*
_ FILE* fpIn = fopen(strFileName1, “wb”);
_ FILE* fpOut = fopen(strFileName2, “wb”);_ - if (fpIn && fpOut)*
- {*
- int iSize = 0;*
_ if (void* pTemp = getOutput(&iSize))_
_ { //fwrite(pTemp, iBytesPerPixel, iWndWidth*iWndHeight, fpOut);_ - int iBytesPerPixel = sizeof(imgDataType);*
_ int iNumComponents = iSize / (iWndWidth * iWndHeight_
_ * iBytesPerPixel);_ - int iTemp = (iImgWidth - 8);*
- fwrite(&iTemp, sizeof(iTemp), 1, fpIn);*
- iTemp = (iImgHeight - 8);*
- fwrite(&iTemp, sizeof(iTemp), 1, fpIn);*
- fwrite(&iBytesPerPixel, sizeof(iBytesPerPixel), 1, fpIn);*
- for (int i = 4; i < (iImgHeight - 4); i++)*
- {*
- for (int j = 4; j < (iImgWidth - 4); j++)*
- {*
_ fwrite(&pucImage[(i * iImgWidth + j)], iBytesPerPixel,_ - 1, fpIn);*
- }*
- }*
- iTemp = (iWndWidth - 8);*
- fwrite(&iTemp, sizeof(iTemp), 1, fpOut);*
- iTemp = (iWndHeight - 8);*
- fwrite(&iTemp, sizeof(iTemp), 1, fpOut);*
- fwrite(&iBytesPerPixel, sizeof(iBytesPerPixel), 1, fpOut);*
- for (int i = 4; i < (iWndHeight - 4); i++)*
- {*
- for (int j = 4; j < (iWndWidth - 4); j++)*
- {*
_ fwrite(&(((imgDataType*) pTemp)[(i * iWndWidth + j) * iNumComponents]), iBytesPerPixel, 1, fpOut);_ - }*
- }*
- }*
- fclose(fpIn);*
- fclose(fpOut);*
- }*
_ FILE* fpOt= fopen(“results.csv”, “a”);_ - if (fpOt)*
- {*
- fprintf(fpOt,“Testcase: %s,%d,%d,”%s",%d,%d,%.2f,%.2f,%d,%d,%d\n",*
- strEXEName, iWndWidth, iWndHeight, strImgPath, iImgWidth,*
- iImgHeight, (float) iWndWidth / iImgWidth,*
- (float) iWndHeight / iImgHeight, iNumCyclesToExec,*
- iSaveOutput, ITERATION_COUNT);*
- fclose(fpOt);*
- }*
- }*
- if (iSaveOutput)*
- {*
- char strFileName1[255], strFileName2[255];*
- strcpy(strFileName1, strEXEName);*
- strcpy(strFileName2, strEXEName);*
- char strExecCnt[32];*
- //itoa(iExecCnt, strExecCnt, 10);*
_ char* inttochar(int iExecCnt, int base)_ - {*
- static char strExecCnt[32] = {0};*
- int i = 30;*
- for(; iExecCnt && i ; --i, iExecCnt /= base)*
_ strExecCnt = “0123456789abcdef”[iExecCnt % base];_
* return &strExecCnt[i+1];*
* }*
* strcat(strFileName1, strExecCnt);*
* strcat(strFileName2, strExecCnt);*
* strcat(strFileName1, "inputImg.bin");
strcat(strFileName2, "outputImg.bin");*
FILE* fpIn = fopen(strFileName1, “wb”);
_ FILE* fpOut = fopen(strFileName2, “wb”);
* if (fpIn && fpOut)*
* {*
* int iSize = 0;*
if (void* pTemp = getOutput(&iSize))
{ //fwrite(pTemp, iBytesPerPixel, iWndWidthiWndHeight, fpOut);_
_ int iBytesPerPixel = sizeof(imgDataType);_
_ int iNumComponents = iSize / (iWndWidth * iWndHeight_
_ * iBytesPerPixel);_
_ int iTemp = (iImgWidth - 8);_
_ fwrite(&iTemp, sizeof(iTemp), 1, fpIn);_
_ iTemp = (iImgHeight - 8);_
_ fwrite(&iTemp, sizeof(iTemp), 1, fpIn);_
_ fwrite(&iBytesPerPixel, sizeof(iBytesPerPixel), 1, fpIn);_
_ for (int i = 4; i < (iImgHeight - 4); i++)_
_ {_
_ for (int j = 4; j < (iImgWidth - 4); j++)_
_ {_
_ fwrite(&pucImage[(i * iImgWidth + j)], iBytesPerPixel,_
_ 1, fpIn);_
_ }_
_ }_
_ iTemp = (iWndWidth - 8);_
_ fwrite(&iTemp, sizeof(iTemp), 1, fpOut);_
_ iTemp = (iWndHeight - 8);_
_ fwrite(&iTemp, sizeof(iTemp), 1, fpOut);_
_ fwrite(&iBytesPerPixel, sizeof(iBytesPerPixel), 1, fpOut);_
_ for (int i = 4; i < (iWndHeight - 4); i++)_
_ {_
_ for (int j = 4; j < (iWndWidth - 4); j++)_
_ {_
_ fwrite(&(((imgDataType) pTemp)[(i * iWndWidth + j) * iNumComponents]), iBytesPerPixel, 1, fpOut);
* }*
* }*
* }*
* fclose(fpIn);*
* fclose(fpOut);*
* }*
FILE* fpOt= fopen(“results.csv”, “a”);
* if (fpOt)*
* {*
* fprintf(fpOt,“Testcase: %s,%d,%d,”%s",%d,%d,%.2f,%.2f,%d,%d,%d\n",*
* strEXEName, iWndWidth, iWndHeight, strImgPath, iImgWidth,*
* iImgHeight, (float) iWndWidth / iImgWidth,*
* (float) iWndHeight / iImgHeight, iNumCyclesToExec,*
* iSaveOutput, ITERATION_COUNT);
_ fclose(fpOt);*
* }*
* }*