Question

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?

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top