943,476 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 10596
  • C RSS
You are currently viewing page 1 of this multi-page discussion thread
Jul 30th, 2003
0

Write to hex, is it possible?

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
keithmolo is offline Offline
1 posts
since Jul 2003
Aug 9th, 2003
0
Re: Write to hex, is it possible?
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'.
Bob
Team Colleague
Reputation Points: 15
Solved Threads: 2
Junior Poster
Bob is offline Offline
129 posts
since Feb 2003
Aug 6th, 2007
0

Re: Write to hex, is it possible?

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....
Reputation Points: 10
Solved Threads: 0
Newbie Poster
super byte is offline Offline
1 posts
since Aug 2007
Aug 6th, 2007
0

Re: Write to hex, is it possible?

So use fprintf() rather than printf()
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Jun 30th, 2008
0

Re: Write to hex, is it possible?

with 010 editor program create array of file :unsigned long char[]={ , ,... }
2d


and write to file

with putc() function
"for" and "wb" activates
Reputation Points: 11
Solved Threads: 0
Newbie Poster
incis is offline Offline
1 posts
since Jun 2008
Jul 1st, 2008
0

Re: Write to hex, is it possible?

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
Reputation Points: 73
Solved Threads: 20
Posting Whiz in Training
ssharish2005 is offline Offline
253 posts
since Dec 2006
Jul 1st, 2008
0

Re: Write to hex, is it possible?

yeah, i really wish threads that have been inactive for more than 90 days would be automatically locked.
Reputation Points: 2143
Solved Threads: 178
Posting Maven
jephthah is offline Offline
2,567 posts
since Feb 2008
Jul 3rd, 2008
0

Re: Write to hex, is it possible?

Quote ...
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.
Reputation Points: 193
Solved Threads: 25
Posting Pro
Jishnu is offline Offline
518 posts
since Oct 2006
Jul 3rd, 2008
0

Re: Write to hex, is it possible?

i just can't imagine it being really THAT hard of a feature to implement.
Reputation Points: 2143
Solved Threads: 178
Posting Maven
jephthah is offline Offline
2,567 posts
since Feb 2008
Jul 4th, 2008
1

Re: Write to hex, is it possible?

>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.
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: press <Esc> to teminate
Next Thread in C Forum Timeline: Arranging from lowest to highest?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC