| View previous topic :: View next topic |
| Author |
Message |
DevilGilad Grandmaster Cheater
Reputation: 0
Joined: 10 May 2007 Posts: 624 Location: Delete C:\WINDOWS folder and you'll be able to see me.
|
Posted: Mon Jun 25, 2007 10:40 am Post subject: [Help] Making tutorial for CE (pointers...) |
|
|
As the title says, I have a problem...
I want to make a button that will change the pointer of a value, and I don't
know how to do it... Can someone explain it to me...?
Thx :]
_________________
|
|
| Back to top |
|
 |
Simsgy Grandmaster Cheater
Reputation: 0
Joined: 07 May 2007 Posts: 581 Location: My new avatar <3
|
Posted: Mon Jun 25, 2007 12:43 pm Post subject: |
|
|
You mean change the value of a pointer or add flags?
Because I don't think you can change a address's pointer 0.o
_________________
|
|
| Back to top |
|
 |
DevilGilad Grandmaster Cheater
Reputation: 0
Joined: 10 May 2007 Posts: 624 Location: Delete C:\WINDOWS folder and you'll be able to see me.
|
Posted: Mon Jun 25, 2007 12:56 pm Post subject: |
|
|
| Simsgy wrote: | You mean change the value of a pointer or add flags?
Because I don't think you can change a address's pointer 0.o |
Dark Byte did it on his tutorial :/
Everything can be...
_________________
|
|
| Back to top |
|
 |
SkatSkat Grandmaster Cheater
Reputation: 0
Joined: 30 Oct 2006 Posts: 648
|
Posted: Mon Jun 25, 2007 1:12 pm Post subject: |
|
|
lol why are you making a tutorial on it if you have to ask us
_________________
"We're betting everything on ourselves tonight" - The Bouncing Souls
 |
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Mon Jun 25, 2007 5:02 pm Post subject: |
|
|
So he knows how when he writes the tutorial.
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Mon Jun 25, 2007 5:36 pm Post subject: |
|
|
Do you mean something like this? (Multi-level pointers)
| Code: | #include <stdio.h>
int main(int argc, const char* argv[])
{
int number=1, blank=0; char answer;
int * p_one = &number, * p_two = ␣
int ** pp_one = &p_one;
printf("Do you want to be amazed? (Y/N) ");
scanf("%s", &answer);
if(answer == 'Y')
{
p_two = &number;
p_one = ␣
pp_one = &p_two;
puts("Woah, didn't see that coming.");
}
else if(answer == 'N')
puts("Go away.");
else
puts("Y or N, pick one next time.");
return 0;
}
|
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25813 Location: The netherlands
|
Posted: Mon Jun 25, 2007 7:27 pm Post subject: |
|
|
I use them inside records (structs)
record 1 has a element that points to record 2, record2 has a element that points to record 3, etc...
and allocate the structures at runtime and trhen set the address of the record in the previous structure
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Mon Jun 25, 2007 10:21 pm Post subject: |
|
|
You can do something like this:
On FormCreate, lets say, add this (pMyPointer is a global PInt16, pOtherPointer is a pointer):
| Code: |
GetMem(pMyPointer,SizeOf(Integer));
GetMem(pOtherPointer,SizeOf(Pointer));
pOtherPointer := @pMyPointer;
pMyPointer^ := 100; //Just an example
|
And when the user clicks a button:
| Code: |
var
pTemp : PInt16;
begin
GetMem(pTemp, SizeOf(Integer) );
pTemp^ := pMyPointer^;
FreeMem(pMyPointer);
pMyPointer := pTemp;
end;
|
Just an example
|
|
| Back to top |
|
 |
DevilGilad Grandmaster Cheater
Reputation: 0
Joined: 10 May 2007 Posts: 624 Location: Delete C:\WINDOWS folder and you'll be able to see me.
|
Posted: Tue Jun 26, 2007 5:03 am Post subject: |
|
|
| Flyte wrote: | Do you mean something like this? (Multi-level pointers)
| Code: | #include <stdio.h>
int main(int argc, const char* argv[])
{
int number=1, blank=0; char answer;
int * p_one = &number, * p_two = ␣
int ** pp_one = &p_one;
printf("Do you want to be amazed? (Y/N) ");
scanf("%s", &answer);
if(answer == 'Y')
{
p_two = &number;
p_one = ␣
pp_one = &p_two;
puts("Woah, didn't see that coming.");
}
else if(answer == 'N')
puts("Go away.");
else
puts("Y or N, pick one next time.");
return 0;
}
|
|
Uhh... I want it on Delphi, man...
Not C++...
_________________
|
|
| Back to top |
|
 |
DeletedUser14087 I post too much
Reputation: 2
Joined: 21 Jun 2006 Posts: 3069
|
Posted: Tue Jun 26, 2007 5:21 am Post subject: |
|
|
| its C,not C++.
|
|
| Back to top |
|
 |
DevilGilad Grandmaster Cheater
Reputation: 0
Joined: 10 May 2007 Posts: 624 Location: Delete C:\WINDOWS folder and you'll be able to see me.
|
Posted: Tue Jun 26, 2007 6:35 am Post subject: |
|
|
| Kaspersky wrote: | | its C,not C++. |
I don't know the difference between them, sorry ~_~
I don't know any of them...
_________________
|
|
| Back to top |
|
 |
Flyte Peanuts!!!!
Reputation: 6
Joined: 19 Apr 2006 Posts: 1887 Location: Canada
|
Posted: Tue Jun 26, 2007 9:33 am Post subject: |
|
|
| DevilGilad wrote: | Uhh... I want it on Delphi, man...
Not C++... |
Variables:
| Code: | number : integer;
blank : integer;
p_one : ^integer;
p_two : ^integer;
|
Before Button is Clicked:
| Code: | number := 1;
blank := 0;
p_one := @number;
p_two := @blank; |
After Button is Clicked:
| Code: | p_one := @blank;
p_two := @number; |
Forgive the crappy coding. I pretty much just taught myself Delphi in about 5 seconds to answer your question.
|
|
| Back to top |
|
 |
|