|
-
Sep 20th, 2001, 03:37 PM
#1
Thread Starter
Lively Member
Conversion
Hey Guys
Does anyone know how to take a the first 4 bytes of a buffer and but it into a DWORD.
Cheers
Peter
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Sep 20th, 2001, 04:45 PM
#2
Didn't we just do this?
Like two days ago....
an ansi c version
PHP Code:
#define DWORD long
DWORD moveDW(char *t);
void main(void ){
char *f = "hi there";
printf("%d\n",moveDW(f) );
return;
}
DWORD moveDW(char *t){
char *buf;
int i;
union u {
unsigned char a[4];
DWORD b;
} m;
buf = t;
for(i=0;i<4;i++){
m.a[i] = *buf;
buf++;
}
return m.b;
}
-
Sep 21st, 2001, 11:32 AM
#3
Thread Starter
Lively Member
LOL
Yeah except 2 days ago it was the other way round DWORD to Buffer.
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Sep 21st, 2001, 11:41 AM
#4
Thread Starter
Lively Member
LOL
Yeah except 2 days ago it was the other way round DWORD to Buffer.
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Sep 21st, 2001, 12:23 PM
#5
transcendental analytic
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|