3
3

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.

Xcode開発環境下,C++でファイル読み込みをする際の覚書

Last updated at Posted at 2015-02-27

C++でテキストファイルやcsvファイルを読み込むときの,ファイルを置くディレクトリについて

  • とりあえず,current working directoryをコンソールに表示して,自分がどこにいるのかを探す
*.c++
#include <unistd.h>

を追加include

*.c++
main()

の下に以下を付け足す。

*.c++
char *cwd ;
cwd=getcwd(NULL, 0);
printf("current working directory:%s\n", cwd);
free(cwd);
  • current working directoryにファイルを移す

あるいは

  • Preferences -> Locations -> Derived Dataに行って,Pathを変更する
3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?