Update contrib.
1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 #include <sys/errno.h>
23 // -----------------------------------------------------------------------------
24 // Creat : Function that stub which
26 // This function takes the system call number and that transforms
27 // controll to the respective routines that performs the task
29 // Returns: -1: if the requested task fails
30 // 0: if the requested task successfull
31 // 0x7FFFFFFF: if invalid system call.
32 // -----------------------------------------------------------------------------
37 #define MAXPATHLEN 260 /* E32STD.H: KMaxFullName + 4 to avoid data loss */
39 EXPORT_C int creat(const char* file, mode_t mode)
41 wchar_t _widename[MAXPATHLEN+1];
46 return -1 ;//null file pointer
49 if ((size_t)-1 != mbstowcs(_widename, file, MAXPATHLEN))
51 return _open_r(&errno , _widename , O_CREAT | O_WRONLY | O_TRUNC , mode);
56 return -1; // Illegal Sequence of wide characters
61 EXPORT_C int wcreat(const wchar_t* file, mode_t mode)
65 return _wopen_r(&errno , file , O_CREAT | O_WRONLY | O_TRUNC , mode);
70 return -1; //null file pointer