linux - How to write a path that include environment variables? -


i'm writing qt app runs in linux. need write file to:

"$xdg_config_dirs/whatever"/ "$home/whatever" 

how resolve environment variables ## heading ##in code?

using nothing plain library functions, use getenv() value of environment variables:

const char *dirs = getenv("xdk_config_dirs"); 

this return null if variable not set in environment, make sure code handles case.

you'll have "interpolation" of variable values rest of text yourself, in case.

not sure if qt provides wrapper or more high-level can interpolation you, haven't worked qt.


Comments

Popular posts from this blog

c++ - How to modify context menu of internet explorer using IDocHostUIHandler::ShowContextMenu? -

android - Spacing between the stars of a rating bar? -

c# - Getting "Internal .Net Framework Data Provider error 30" error when column has NULL value -