Write to hex, is it possible?

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jul 2003
Posts: 1
Reputation: keithmolo is an unknown quantity at this point 
Solved Threads: 0
keithmolo keithmolo is offline Offline
Newbie Poster

Write to hex, is it possible?

 
0
  #1
Jul 30th, 2003
Please let me know if this is possible or even remotely possible! I need to write to a file, but directly to hex. For example, if I write "2D" to the file, i want to be able to open the file in a hex editor and see "2D" in the hex portion, not the ASCII portion. the only way i have been able to get "2D" into the hex portion is by writing "-" to the file.

i have been told this is possible, but so far have come up empty-handed. any ideas, hints, code, or suggestions would be greatly appreciated! Thanks!

keith
Reply With Quote Quick reply to this message  
Join Date: Feb 2003
Posts: 129
Reputation: Bob is an unknown quantity at this point 
Solved Threads: 1
Team Colleague
Bob Bob is offline Offline
Team Member
 
0
  #2
Aug 9th, 2003
What format is the original data in, that you want written to the file? Your hex editor happens to display the stored value in hex format when it reads it. You might equally display it in decimal, or ASCII, or in some other format.

It's not stored as 'hex'.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1
Reputation: super byte is an unknown quantity at this point 
Solved Threads: 0
super byte super byte is offline Offline
Newbie Poster

Re: Write to hex, is it possible?

 
0
  #3
Aug 6th, 2007
yeah.. man.. i hav same problem.. i m also able to write my data in Dos Prompt using printf("%02x",mydata);

but wen i write this data into a file using fwrite(mydata,2,count,File *fp);

then its showing byte formate.. i need it in file as showing by printf() in dos screen.... can nebody tell me solution.. yaar hav become so fed-up....
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: Write to hex, is it possible?

 
0
  #4
Aug 6th, 2007
So use fprintf() rather than printf()
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 1
Reputation: incis is an unknown quantity at this point 
Solved Threads: 0
incis incis is offline Offline
Newbie Poster

Re: Write to hex, is it possible?

 
0
  #5
Jun 30th, 2008
with 010 editor program create array of file :unsigned long char[]={ , ,... }
2d


and write to file

with putc() function
"for" and "wb" activates
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 251
Reputation: ssharish2005 is on a distinguished road 
Solved Threads: 20
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: Write to hex, is it possible?

 
0
  #6
Jul 1st, 2008
LOL you've opened a thread which is like two years old now. The OP might have already solved this problem by now.

Perhaps, he might have got a far better knowledge than what he had when he started this thread. And you post what information does it gives him anyway???? Try to explain things a bit more clear!!

ssharish
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,669
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 123
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Write to hex, is it possible?

 
0
  #7
Jul 1st, 2008
yeah, i really wish threads that have been inactive for more than 90 days would be automatically locked.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 514
Reputation: Jishnu will become famous soon enough Jishnu will become famous soon enough 
Solved Threads: 26
Jishnu's Avatar
Jishnu Jishnu is offline Offline
Posting Pro

Re: Write to hex, is it possible?

 
0
  #8
Jul 3rd, 2008
yeah, i really wish threads that have been inactive for more than 90 days would be automatically locked.
I'd reported this problem earlier in DaniWeb Community Feedback, but somehow, things didn't work out. Some problem regarding the workload that means for the mods or the work required for automating the 'lock' feature.
Last edited by Jishnu; Jul 3rd, 2008 at 2:14 pm.
"You know you're a computer geek when you try to shoo a fly away from the monitor screen with your cursor. That just happened to me. It was scary." - Juuso Heimonen.

"The only truly secure computer is one buried in concrete, with the power turned off and the network cable cut." - Anonymous.
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 1,669
Reputation: jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of jephthah has much to be proud of 
Solved Threads: 123
jephthah's Avatar
jephthah jephthah is offline Offline
Posting Virtuoso

Re: Write to hex, is it possible?

 
0
  #9
Jul 3rd, 2008
i just can't imagine it being really THAT hard of a feature to implement.
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,850
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: 754
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Senior Bitch

Re: Write to hex, is it possible?

 
1
  #10
Jul 4th, 2008
>i just can't imagine it being really THAT hard of a feature to implement.
It's not. In fact, I believe it's a feature of vBulletin if you choose to enable it.

>i really wish threads that have been inactive for
>more than 90 days would be automatically locked.
I don't. It's a good idea in theory, but painfully annoying in practice. Besides, there's no rule against adding to an existing discussion, regardless of how old it is.
New members chased away this month: 4
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C Forum


Views: 7552 | Replies: 13
Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC