ReactOS 0.4.15-dev-8219-ge8b88cf
putenv.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/sdk/crt/stdlib/putenv.c
5 * PURPOSE: Unknown
6 * PROGRAMER: Unknown
7 * UPDATE HISTORY:
8 * 25/11/05: Added license header
9 */
10#include <precomp.h>
11
12/* misc/environ.c */
13int SetEnv(const wchar_t *option);
14
15/*
16 * @implemented
17 */
18int _putenv(const char* val)
19{
20 int size, result;
21 wchar_t *woption;
22
23 size = MultiByteToWideChar(CP_ACP, 0, val, -1, NULL, 0);
24 woption = malloc(size* sizeof(wchar_t));
25 if (woption == NULL)
26 return -1;
27 MultiByteToWideChar(CP_ACP, 0, val, -1, woption, size);
28 result = SetEnv(woption);
29 free(woption);
30 return result;
31}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
GLsizeiptr size
Definition: glext.h:5919
GLuint GLfloat * val
Definition: glext.h:7180
GLuint64EXT * result
Definition: glext.h:11304
int _putenv(const char *val)
Definition: putenv.c:18
int SetEnv(const wchar_t *option)
Definition: environ.c:210
Definition: getopt.h:109