문제

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