qLibc
qsystem.c File Reference

System APIs. More...

Go to the source code of this file.

Functions

const char * qgetenv (const char *envname, const char *defstr)
 Get system environment variable.
 
char * qsyscmd (const char *cmd)
 Get the result string of external command execution.
 

Detailed Description

System APIs.

Definition in file qsystem.c.

Function Documentation

◆ qgetenv()

const char * qgetenv ( const char *  envname,
const char *  defstr 
)

Get system environment variable.

Parameters
envnameenvironment name
defstrif not found, return this string
Returns
a pointer of environment variable

Definition at line 54 of file qsystem.c.

◆ qsyscmd()

char * qsyscmd ( const char *  cmd)

Get the result string of external command execution.

Parameters
cmdexternal command
Returns
malloced string pointer which contains result if successful, otherwise returns NULL
Note
If the command does not report result but it is executed successfully, this will returns empty string(not null)

Definition at line 71 of file qsystem.c.