Boost.Nowide
|
00001 // 00002 // Copyright (c) 2012 Artyom Beilis (Tonkikh) 00003 // 00004 // Distributed under the Boost Software License, Version 1.0. (See 00005 // accompanying file LICENSE_1_0.txt or copy at 00006 // http://www.boost.org/LICENSE_1_0.txt) 00007 // 00008 #ifndef BOOST_NOWIDE_CSTDLIB_HPP 00009 #define BOOST_NOWIDE_CSTDLIB_HPP 00010 00011 #include <stdlib.h> 00012 #include <errno.h> 00013 #include <boost/nowide/stackstring.hpp> 00014 namespace boost { 00015 namespace nowide { 00016 00017 #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) 00018 00019 using ::system; 00020 00021 #else // Windows 00022 00028 inline int system(char const *cmd) 00029 { 00030 if(!cmd) 00031 return _wsystem(0); 00032 wstackstring wcmd; 00033 if(!wcmd.convert(cmd)) { 00034 errno = EINVAL; 00035 return -1; 00036 } 00037 return _wsystem(wcmd.c_str()); 00038 } 00039 00040 #endif 00041 } // nowide 00042 } // namespace boost 00043 00044 #endif 00045 00046 // vim: tabstop=4 expandtab shiftwidth=4 softtabstop=4