12
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Visual Studio CodeでC言語/C++デバッグ時に変数の値を16進数で表示する

Last updated at Posted at 2018-04-04

はじめに

Visual Studio CodeでC言語/C++をgdbを使ってデバッグするときに,char変数の値を確認しようとすると数字や記号,アルファベットなど表示可能な文字の場合は10進数表記とその文字が表示されます.また制御文字や128以上の値の場合には10進数表記と8進数表記が表示されます.

image.png

文字データを扱っているときはこれで見やすいのですが,例えば通信電文など文字コードでなく単純なByteデータをchar変数に入れている時などには16進数で表示されると見やすいので,方法を調べました.

解決方法

ウォッチ式に<変数名>,hと指定すれば16進数で表記されます.これでByte配列のデータの確認なども見やすくなりました.

image2.png

charに限らずint変数などもこの方法で16進数で表示されます.

12
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?