LoginSignup
23
23

More than 5 years have passed since last update.

NSLog の出力先を変更する

Last updated at Posted at 2012-12-26

NSLog は標準エラーに出力される。
C言語のfreopen関数を使うとstderrの出力先を変更することが出来るので、NSLog の出力も別の場所に変更(ファイル化)することができる。エラーを抑制するなりファイルに書き出すなり。

char *filePath = (char*)[@"/path/to/file.txt" UTF8String];
freopen(filePath, "a+", stderr);
23
23
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
23
23