-7

chars の配列があり"0x55"ます。私がしたいのは、それを に変換することですchar( UASCII 0x55 = のためU)。

では、この変換を行うにはどうすればよいでしょうか。

#include <windows.h>

int main()
{
array[] = "0x55"
char test;

**// I want to move the string to that test to be one character which is U**

}

助言がありますか?

4

1 に答える 1

3

私はこれがあなたが求めているものだと思います:

int main(int argc,char**argv)
{
  char array[] = "0x55";
  int value;
  char test;

  sscanf(array,"%x",&value);
  test = value;

  return 0;
}

C ++では、少し異なる方法でコーディングしますが、これはCの質問のようです。

于 2013-01-03T23:53:17.787 に答える