Exemple #1
0
int JpegStegoDecoder::Decode(char *infile, char *outfile, bool getMes)
{
	if(!outfile)
		outfile = "nul";

	// test for existing input and output files
	FILE *fp;
	if ((fp = fopen(infile, READ_BINARY)) == NULL) {
		throw FileNotFoundException("File not found\n",infile);
	}
	fclose(fp);
	if ((fp = fopen(outfile, WRITE_BINARY)) == NULL) {
		throw FileNotFoundException("File not found\n",outfile);
	}
	fclose(fp);

	InitJpegStego(true);

	int argc = 3;
	char *argv[3];
	char name[]="djpeg";
	
	argv[0]=name;
	argv[1]=infile;
	argv[2]=outfile;
	

	return main_djpeg(argc, argv, sData);
}
Exemple #2
0
int JpegStegoDecoder::Decode(char *infile, char *outfile, bool getMes)
{
//	if(!outfile)
#ifdef _WIN32
		outfile = (char*)"nul";
#else
		outfile = (char*)"/dev/null";
#endif

	// test for existing input and output files
	FILE *fp;
	if ((fp = fopen(infile, READ_BINARY)) == NULL) {
		throw FileNotFoundException("File not found\n",infile);
	}
	fclose(fp);
	if ((fp = fopen(outfile, WRITE_BINARY)) == NULL) {
		throw FileNotFoundException("File not found\n",outfile);
	}
	fclose(fp);

	if (blog) {
		slog = new JpegStegoLog;
		slog->Bin(binary);
		slog->setLogFileName(logfile);
		slog->openLOG(work_component);
	}

	InitJpegStego(true);

	int argc = 4;
	char *argv[4];
	char name[]="djpeg";
	
	argv[0]=name;
	argv[1]="-outfile";
	argv[2]=outfile;
	argv[3]=infile;

	return main_djpeg(argc, argv, sData);
}