PDA

View Full Version : Source code



mlg solidsnake
04-28-2007, 05:56 AM
ok so i got this source code and i need to compile it, but it wont let me compile it because its giving me some errors and i dont know how to fix them im using dev-C++ complier if someones willing to help maybe look at the code and see if theirs errors"?

Moonbat
04-28-2007, 12:07 PM
Sure. Post the code here, and if possible, the errors you're getting.

Ezekiel
04-28-2007, 12:30 PM
Yeah, we'll need those errors.

mlg solidsnake
04-28-2007, 06:03 PM
ok well the code is to long so its not letting me type it all in, any other way?

Ezekiel
04-28-2007, 06:25 PM
Split it into two posts or upload it to www.divshare.com.

mlg solidsnake
04-28-2007, 06:28 PM
http://www.divshare.com/download/50****-*e2

Ezekiel
04-28-2007, 06:53 PM
And what errors are you getting? I'm in Linux right now, so can't compile it myself.

EDIT: Didn't see the text below the code. I'll read it now.

It doesn't look like the whole error messages are in the file. They seem to cut off.

Also, did you link libraries like ws2_*2 (I think) into the program? That's usually the cause with things like this.

mlg solidsnake
04-28-2007, 07:00 PM
And what errors are you getting? I'm in Linux right now, so can't compile it myself.

EDIT: Didn't see the text below the code. I'll read it now.

It doesn't look like the whole error messages are in the file. They seem to cut off.

Also, did you link libraries like ws2_*2 (I think) into the program? That's usually the cause with things like this.
well no and yes, i tried linking ws2 into the library but i dont think i did it in the right spot, btw did you try compiling it/? if so did it give you a error? maybe ill try something will edit soon
Edit: yah linking the ws2*2 didnt help, and my pc crashing didnt help the progress either i was downloading linux xp and my pc crashed anyone know how i can recover the file? it was done but ii didnt open it,

Ezekiel
04-28-2007, 07:52 PM
well no and yes, i tried linking ws2 into the library but i dont think i did it in the right spot, btw did you try compiling it/?

I'm in Ubuntu (Linux) right now, so can't compile it as that code is for Windows.

mlg solidsnake
04-28-2007, 08:03 PM
Ahh, alright.. ill just get another code, or just write my own in vb..

Moonbat
04-28-2007, 10:42 PM
I think I see what the problem is.

The highlited error is given because the function get_keys() is a type void function. Functions with type void do not return an assignable value.

In other words, you cannot assign the result of a type void function to an int, char, bool, or any other type of variable. For example:



//psuedocode, may not be correct syntax, but a general idea
int blah(x)
{
X*2
}


The function blah() will take user input and do something. You can then assign this to something. So if the user entered 6, he would get the number *2 and be able to assign *2 to another variable.

Void functions are usually just for repetitive tasks, such as re*****ing the screen every minute, and other such tasks.

Ezekiel
04-29-2007, 06:08 AM
That's true Moonbat, but the function returns an integer (int). The void is in between the ( and ) to indicate that it takes no parameters. Without the full errors, there's not really much I can say, apart from I don't think you've linked in all the necessary libraries for Windows, or perhaps you are trying to compile this code as a C++ project in Dev-Cpp when in fact it is C code. I thought they were interchangeable, but it's something to try.

Moonbat
04-29-2007, 11:49 AM
A function that takes no parameters (a void function) cannot return an assignable value. So therefore, even if the overall function does return an int, you can't assign it to any other variable.

Ezekiel
04-29-2007, 04:09 PM
A function that takes no parameters (a void function) cannot return an assignable value. So therefore, even if the overall function does return an int, you can't assign it to any other variable.

Though I haven't done any C++ programming in a while, I know that functions that take no parameters can return values if they're not preceded by void. Functions' return values are dictated by the type stated before them,


int SomeFunction()
{
/* Do something */
return *;
}

int aaa = 0;

aaa = SomeFunction();

In this case, SomeFunction returns an integer. It has no parameters.

A function declared to return void, however, can't return anything -- it has no return statement:


void SomeFunction()
{
/* Do something */
}

SomeFunction();


A function that takes no parameters (a void function) cannot return an assignable value.

A void function in my definition is a function declared as type void (void SomeFunction()). One that doesn't take any parameters is just a function without parameters.

Moonbat
04-29-2007, 05:03 PM
Ah, okay, I was getting a little confused.

The get_keys() function in the keylogger code was written int get_keys(void). I got a little confused.

mlg solidsnake
04-29-2007, 05:07 PM
so it seems to me theirs no hope for this source code lol

Moonbat
04-29-2007, 08:25 PM
I'm guessing it's some badly written code.

Either that, or the guy made mistakes on purpose so only experienced code gurus would know what to do with it. Either way, I'm not sure.

nozf3r4tu
04-29-2007, 09:51 PM
instead of //psuedocode <-- try -->//pseudocode <--?? :confused:


//psuedocode, may not be correct syntax, but a general idea
int blah(x)
{
X*2
}


Well my limitation on coding is awesome...lol

Ezekiel
04-30-2007, 12:08 PM
Nah noz, that was just a comment. In C++, comments are text that is ignored by the compiler, like labels on the code that don't affect the final program. Comments in C++ are either the whole line after // or between /* and */.

I've also come to the conclusion that it was badly-written code. I s***ested a few things though which he could have tried, and he could have included the full error messages.