5
4

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.

VisualStudioデバッガのコマンド引数経由で"%"を渡す

Last updated at Posted at 2014-08-15

Microsoft Visual Studio (2012)のデバッガ経由で、コマンドライン引数に%を含む文字列を指定したとき、プログラム側に意図通りの文字列データが渡されない。

dumparg.c
# include <stdio.h>
int main(int argc, char* argv[])
{
  printf("%s", argv[1]);
}
指定した文字列:foo-%05d.ext
渡される文字列:"foo-\05d.ext" ("\05"は制御文字)

プログラムに意図通り文字%を与えるには、VisualStudioデバッガ側/コマンドライン引数上では%25を指定すること。

指定した文字列:foo-%2505d.ext
渡される文字列:"foo-%05d.ext"
5
4
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
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?