what is wrong with this source?

Posts 1–7 of 7 · Page 1 of 1
what is wrong with this source?
I am trying to use source provided by Mrk to patch a program. Why doesnt this work?

Code:
nclude <fstream>
#include <stdlib.h>
using namespace std;

int main(int argc, char* argv[])
{
	int offset = 0x0BADC0DE;	//store offset here.....
	char orgbyte[6];	//buffer for bytes that we read in..
	int obyte[6] = {0x00,0x00,0x00,0x00,0x00,0x00};	//write in original bytes here to be able to unpatch..
	int rbyte[6] = {0x90,0x90,0x90,0x90,0x90,0x90};	//which bytes to write..
	char filename[255] = "Gunz.exe";	//name of the file to patch..
	char buffer[255];	//buffer to read to..
	ifstream fil(filename);		//open the file...
	if (fil.is_open())	//if it's fkin open..
	{
		fil.seekg( offset , ios::beg);	//go to the offset that we're going to patch...
		fil.read( orgbyte , sizeof obyte );	//read bytes from the file..
		if( atoi(orgbyte) == obyte )	//if the bytes read are the original bytes we'll patch! :)
		{
			printf("Xara Xtreme Patcher  By Fallen Empires.****** ");
			printf("††††††††††††††††††††††††††††††††\n");
			printf(" Xara Trial Has Been Frozen ;)\n");
			printf(" ††††††††††††††††††††††††††††††††\n");
			printf(" Offset Patcher By Mrk");
			system("pause > nul");	//wait for user input
			fil.close();	// close the file now
			return 0;	//end process
		}
		else
		{
			printf("File Could Not be patched");		// oh noews :/
			fil.close();		// close the file now
			return 1;	//end with error
		}
	}
	else
	{
		printf("Xara Xtreme Patcher By Fallen Empires.******\n");
		printf("††††††††††††††††††††††††††††††††\n");
		printf(" What the hell is wrong with you? Where is xtreme.exe???\n");
		printf("††††††††††††††††††††††††††††††††\n");
		printf(" Offset Patcher By Mrk");
		system("pause > nul");	//wait for user input
	}
	fil.close();		// close the file now
	return 0;
}
i get these errors:
Code:
Error	1	error C2446: '==' : no conversion from 'int *' to 'int'	c:\documents and settings\chris tarquini\my documents\visual studio 2005\projects\xpatcher\xpatcher.cpp	27	
Error	2	error C2040: '==' : 'int' differs in levels of indirection from 'int [6]'	c:\documents and settings\chris tarquini\my documents\visual studio 2005\projects\xpatcher\xpatcher.cpp	27
The start? where is says "nclude <fstream>" Isnt it? "#include <fstream>"
Thats one of the reasons why i dont like C++ its so fragile (try to compile the source code from another computer and i can acertain you that i wont compile because of linking errors). And the .NET environment of C++ is just pure crap, the one of C# is way better though being made in the same year.
Quote Originally Posted by FluffyStuff View Post
Thats one of the reasons why i dont like C++ its so fragile (try to compile the source code from another computer and i can acertain you that i wont compile because of linking errors). And the .NET environment of C++ is just pure crap, the one of C# is way better though being made in the same year.

I love how the code he has given is NOT in C++. That is obviously C

printf is a C command or C# i dunno.

std::cout is a C++ command/function anything you want to call it
Quote Originally Posted by Migrashin View Post
I love how the code he has given is NOT in C++. That is obviously C

printf is a C command or C# i dunno.

std::cout is a C++ command/function anything you want to call it
No you idiot, that's C++, and C# is C. I didn't read through the code but it looks like the integers you are calling upon are in an array hence the error, try putting [0] after it on the same line of the error. Haven't coded in C++ in a while, so my brain isn't that fresh on it.
printf is not a C++ command. std::cout is a C++ command.

C:
printf("Hello World!\n");

C++:
cout << "Hello World!" << endl;

or

std::cout << "Hello World!\n";
You retard, i just created a new project in C++ (one with Hello World in it) and this file was auto created:
Code:
// Test2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

int main(int argc, char* argv[])
{
	printf("Hello World!\n");
	return 0;
}
And just for your info in C# it would be Console.Write("Hello World!");
Please http://www.justfuckinggoogleit.com before making stupid comments.
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?