FILE *fout = fopen(templinuxPath+"\\config.tmp", "wb"); if (!fout) { AfxMessageBox("Cannot open output file", MB_OK); exit(3); } FILE *fin = fopen(templinuxPath+"\\Config.ini", "rb"); if (!fin) { AfxMessageBox("Cannot open Config.ini file", MB_OK); exit(3); } else { char inbuf[BUF_SIZE], outbuf[BUF_SIZE]; int cnt2=0; while(!feof(fin)) { int count = fread(&inbuf, sizeof(char), sizeof(inbuf), fin); if (ferror(fin)) { AfxMessageBox("Error in reading Config.ini file", MB_OK); exit(3); } char *cpin = inbuf; char *cpout = outbuf; while (count-- > 0) { if (*cpin == CRVALUE) cpin++; else { *cpout++ = *cpin++; cnt2++; } } fwrite(&outbuf, sizeof(char), cnt2, fout); if (ferror(fout)) { AfxMessageBox("Error in writing Config.ini file", MB_OK); exit(3); } cnt2=0; } fclose(fin); } fclose(fout); DeleteFile(templinuxPath+"\\Config.ini"); rename(templinuxPath+"\\config.tmp",templinuxPath+"\\config.ini");
void CreateLinuxInstaller(){	char currentdir[_MAX_PATH];	_getcwd(currentdir,_MAX_PATH);	CopyDirectory(xpiDstPath, templinuxPath + xpiDir);	DeleteFile(templinuxPath + xpiDir + "\\N6Setup.exe");	CopyFile(xpiDstPath+"\\Config.ini", templinuxPath+"\\Config.ini",FALSE);	DeleteFile(templinuxPath + xpiDir + "\\Config.ini");	_chdir(outputPath);	templinuxPath = tempPath;	templinuxPath.Replace("\\", "/");	templinuxPath.Replace(":","");	templinuxPath.Insert(0,"/cygdrive/");	DeleteFile(tarfile);	CString command = "tar -zcvf " + tarfile + " -C " +quotes+ templinuxPath + "/" + templinuxDir +quotes+ spaces + nsinstallerDir;    	ExecuteCommand((char *)(LPCTSTR) command, SW_HIDE, INFINITE);	_chdir(currentdir);}