ENVGetEnvironmentVariable

Syntax

#include <cafe/env.h>

int ENVGetEnvironmentVariable(const char* key, char *value_buf, u32 value_buf_size);

Parameters

key The name of the environment variable on the host PC.
value_buf The buffer to hold the environment variable string.
value_buf_size The size available in the provided buffer.

Return Values

ERROR_OK(0) Successful.
ERROR_VALUE_FAIL_ALLOC(-22) The system was unable to allocate enough space to acquire the information.
ERROR_VALUE_INVALID_ARG(-29) One of the parameters is improperly set.
-393227 Attempt was made from a devkit to request the value of an environment variable located on a host PC when no host PC was attached.

When the length of the environment variable on the host exceeds 254, a NULL terminated string is returned as though the environment variable does not exist.

Description

Retrieves the specified environment variable from the host PC environment for use in the Cafe environment. The maximum length of the string is limited to 254 characters with the 255th character being used for NULL termination. If the length of value_buf is less than the length of the retrieved environment variable, the API will write as many characters as possible, minus one for the null terminator.

A PCFS connection to the host PC is required for this API.

Do Not Call From

Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.
Production code Do not call this function in production code. It is available only for debugging purposes.

Revision History

2014/04/11 Clarified effects when value_buf is too small.
2014/02/19 Removed "Wii U" in Do Not Call From section.
2013/05/08 Automated cleanup pass.
2011/07/14 Initial version.


CONFIDENTIAL