os/ossrv/genericopenlibs/openenvcore/libc/src/wfdopen.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description:
    15 * Name        : wfdopen.c
    16 * Part of     : LIBC
    17 * Contains the source for wfdopen
    18 * Version     : 1.0
    19 *
    20 */
    21 
    22 
    23 
    24 #include <sys/types.h>
    25 #include <stdlib_r.h>
    26 #include <stdio_r.h>
    27 #include <errno.h>
    28 #include "local.h"
    29 
    30 EXPORT_C FILE * wfdopen (int fd, const wchar_t *mode)
    31 	{
    32 	char destmode[4];
    33 	size_t siz;
    34 
    35 	destmode[0] = '\0';
    36 	if(mode==NULL)
    37     {
    38     	errno = EINVAL;
    39 	    return (NULL);
    40     }
    41 	siz = wcstombs(destmode, mode, 4);
    42 
    43 	return fdopen(fd,destmode);
    44 	}
    45 
    46