11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Environment interactiondescribes the locale. It can either be a string previously returned by setlocale, or itcan be a string constructed after the pattern:lang_REGIONorlang_REGION.encodingThe lang part specifies the language code, and the REGION part specifies a regionqualifier, and encoding specifies the multibyte character encoding that should be used.The lang_REGION part matches the _LOCALE_USE_LANG_REGION preprocessorsymbols that can be specified in the library configuration file.ExampleThis example sets the locale configuration symbols to Swedish to be used in Finland andUTF8 multibyte character encoding:setlocale (LC_ALL, "sv_FI.Utf8");Environment interactionAccording to the C standard, your application can interact with the environment usingthe functions getenv and system.Note: The putenv function is not required by the standard, and the library does notprovide an implementation of it.The getenv function searches the string, pointed to by the global variable __environ,for the key that was passed as argument. If the key is found, the value of it is returned,otherwise 0 (zero) is returned. By default, the string is empty.To create or edit keys in the string, you must create a sequence of null terminated stringswhere each string has the format:key=value\0The last string must be empty. Assign the created sequence of strings to the __environvariable.For example:const char MyEnv[] = ”Key=Value\0Key2=Value2\0”;__environ = MyEnv;If you need a more sophisticated environment variable handling, you should implementyour own getenv, and possibly putenv function. This does not require that you rebuildthe library. You can find source templates in the files getenv.c and environ.c in the66<strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>Reference Guide

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!