|
-
August 24th, 2004, 08:19 AM
#1
Reading hexadecimal values for a file
Hi! I'm trying to read some values stored in a file.The file looks like this:
GENIUS 0 0x0080000000000000 black_pawn1
GENIUS 1 0x0040000000000000 black_pawn2
.................................................................................................................
and it stores the startup positions for the chess pieces.
I tryed something like this but it doesn't work:
<h3>fscanf(fp,"%d%xll",&id,&move);</h3> where ll is for unsigned __int64 or at least this is what i want. it to be(in case i'm wrong)
//**********************************************************
FILE* fp;
char buffer[100];
unsigned __int64 move;
unsigned int id;
CList* node;
fp=fopen("startup.txt","rt");
if(!fp)return false;
while(!feof(fp))
{
fscanf(fp,"%s",buffer);
fscanf(fp,"%d%xll",&id,&move);
node=new CList(move,id);
if(!stricmp(buffer,"GENIUS"))
{
geniusList.Insert(node);
}else{
if(!stricmp(buffer,"MINIME"))
{
minimeList.Insert(node);
}
}
fgets(buffer,100,fp);
}
return true;
}
ThankX!
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
|