sl@0: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: // sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "sysreent.h" sl@0: sl@0: // ----------------------------------------------------------------------------- sl@0: // Creat : Function that stub which sl@0: sl@0: // This function takes the system call number and that transforms sl@0: // controll to the respective routines that performs the task sl@0: // requested . sl@0: // Returns: -1: if the requested task fails sl@0: // 0: if the requested task successfull sl@0: // 0x7FFFFFFF: if invalid system call. sl@0: // ----------------------------------------------------------------------------- sl@0: // sl@0: sl@0: extern "C" { sl@0: sl@0: #define MAXPATHLEN 260 /* E32STD.H: KMaxFullName + 4 to avoid data loss */ sl@0: sl@0: EXPORT_C int creat(const char* file, mode_t mode) sl@0: { sl@0: wchar_t _widename[MAXPATHLEN+1]; sl@0: sl@0: if(!file) sl@0: { sl@0: errno = EFAULT ; sl@0: return -1 ;//null file pointer sl@0: } sl@0: sl@0: if ((size_t)-1 != mbstowcs(_widename, file, MAXPATHLEN)) sl@0: { sl@0: return _open_r(&errno , _widename , O_CREAT | O_WRONLY | O_TRUNC , mode); sl@0: } sl@0: else sl@0: { sl@0: errno = EILSEQ; sl@0: return -1; // Illegal Sequence of wide characters sl@0: } sl@0: } sl@0: sl@0: sl@0: EXPORT_C int wcreat(const wchar_t* file, mode_t mode) sl@0: { sl@0: if (file) sl@0: { sl@0: return _wopen_r(&errno , file , O_CREAT | O_WRONLY | O_TRUNC , mode); sl@0: } sl@0: else sl@0: { sl@0: errno = EFAULT; sl@0: return -1; //null file pointer sl@0: } sl@0: } sl@0: }