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?

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top