UNIX Socket FAQ

A forum for questions and answers about network programming on Linux and all other Unix-like systems

You are not logged in.

  • Index
  • » C++
  • » How to change characters into hex number

#1 2005-05-02 09:54 AM

gold_marigold55
Member
Registered: 2005-04-23
Posts: 7

Re: How to change characters into hex number

Hello,

I like to read characters from a file and convert those characters into hex value then write to other file.

I tried to convert characters by using "cout << hex" or "hex (cout);" to show on stdout but failed.

Also how can I write a space to the file as I found I could write characters to the file but without spaces, newlines, etc..

Much appreciated if can show me how to do that.

Thanks.

;-)

Offline

#2 2005-05-02 04:56 PM

kerzum
Guest

Re: How to change characters into hex number

char c='a';
cout << "code for" << c << " is " << hex << int(a) << endl;
  • Index
  • » C++
  • » How to change characters into hex number

Board footer

Powered by FluxBB