binary file

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Apr 2006
Posts: 42
Reputation: ghadahelal is an unknown quantity at this point 
Solved Threads: 0
ghadahelal ghadahelal is offline Offline
Light Poster

binary file

 
0
  #1
May 31st, 2007
hi all ,
i have a program that read its input from a file in binary mode!
now i nead to store this data and to compare it with another data.
which datataype can my input take.

also, the comapred stream is in this form 0004a4900
i made this stream as a cons int and then with 0x it is already stored as an hex. stream
now when i read i want to search this strream in my input file
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,602
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 712
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: binary file

 
0
  #2
May 31st, 2007
>which datataype can my input take.
The same data type you used to write it if you want a meaningful comparison. If you're just checking for equality, you can use unsigned char and compare every byte individually.

>also, the comapred stream is in this form 0004a4900
>i made this stream as a cons int and then with 0x it is already stored as an hex. stream
>now when i read i want to search this strream in my input file
There's no question here.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 42
Reputation: ghadahelal is an unknown quantity at this point 
Solved Threads: 0
ghadahelal ghadahelal is offline Offline
Light Poster

Re: binary file

 
0
  #3
May 31st, 2007
unsigned char is for byte or what!!
i mean what is the difference between char and unsigned char?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,602
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 712
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: binary file

 
0
  #4
May 31st, 2007
>i mean what is the difference between char and unsigned char?
char isn't portable because it could be either signed or unsigned.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 42
Reputation: ghadahelal is an unknown quantity at this point 
Solved Threads: 0
ghadahelal ghadahelal is offline Offline
Light Poster

Re: binary file

 
0
  #5
May 31st, 2007
and what does unsigned char mean?

is each byte 'll read as an unsigned char?
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,602
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 712
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: binary file

 
0
  #6
May 31st, 2007
Yes.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC