Sujet : acces à une variable d'environnement windows sous C++ |
Carbon_14 |
Si ce n'est QUE retrouver le chemin dans lequel se trouve Windows (Win3, Win95 chez moi, et non WINDOWS), il y a deux fonctions
"The GetWindowsDirectory function retrieves the path of the Windows directory. The Windows directory contains such files as Windows-based applications, initialization files, and Help files."
et "The GetSystemDirectory function retrieves the path of the Windows system directory. The system directory contains such files as Windows libraries, drivers, and font files."
Cela existe aussi pour le répertoire TEMP, pour y mettre des fichiers effacés après usage fugitif.
"The GetTempPath function retrieves the path of the directory designated for temporary files. "
C'est normalement bon en Win 16 et Win32 bits. Sous Linux, faut chercher l'équivalent. |
BENB |
El_gringo tu as du bol, le man de getenv est pas trop long...
Citation :
getenv(3C) getenv(3C)
NAME
getenv() - return value for environment name
SYNOPSIS
#include <stdlib.h>
char *getenv(const char *name);
DESCRIPTION
getenv() searches the environment list (see environ(5)) for a string
of the form name=value, and returns a pointer to the value in the
current environment if such a string is present, otherwise a NULL
pointer. name can be either the desired name, null-terminated, or of
the form name=value, in which case getenv() uses the portion to the
left of the = as the search key.
APPLICATION USAGE
getenv() is thread-safe. It is not async-cancel-safe.
WARNINGS
getenv() returns a pointer to static data which can be overwritten by
subsequent calls.
EXTERNAL INFLUENCES
Locale
The LC_CTYPE category determines the interpretation of characters in
name as single- and/or multi-byte characters.
International Code Set Support
Single- and multi-byte character code sets are supported.
SEE ALSO
exec(2), putenv(3C), environ(5).
STANDARDS CONFORMANCE
getenv(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1,
POSIX.2, ANSI C
Hewlett-Packard Company - 1 - HP-UX Release 11.00: October 1997
Standard input: END
|
|