質問

I'm new to Linux system programming. The task is: create system variable "MY_DIR" with valuable "lab01" and create any file inside it.

I've successfully created folder, but I can't create any file using varialble

putenv("MY_DIR=lab01");
mkdir_ret_code = mkdir(("/home/Alexander/%s",getenv("MY_DIR")),0777);

How to solve this problem?

役に立ちましたか?

解決

Use an array and use these functions http://linux.die.net/man/3/string

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top