Pregunta

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?

¿Fue útil?

Solución

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top