"Fossies" - the Fresh Open Source Software Archive

Member "ansifilter-2.18-x64/src/platform_fs.cpp" (30 Jan 2021, 1465 Bytes) of package /windows/misc/ansifilter-2.18-x64.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the last Fossies "Diffs" side-by-side code changes report for "platform_fs.cpp": 2.16_vs_2.17.

    1 /***************************************************************************
    2                           platform_fs.cpp  -  description
    3                              -------------------
    4     begin                : Sun Oct 13 2007
    5     copyright            : (C) 2007-2020 by Andre Simon
    6     email                : a.simon@mailbox.org
    7  ***************************************************************************/
    8 /*
    9 This file is part of ANSIFilter.
   10 
   11 ANSIFilter is free software: you can redistribute it and/or modify
   12 it under the terms of the GNU General Public License as published by
   13 the Free Software Foundation, either version 3 of the License, or
   14 (at your option) any later version.
   15 
   16 ANSIFilter is distributed in the hope that it will be useful,
   17 but WITHOUT ANY WARRANTY; without even the implied warranty of
   18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   19 GNU General Public License for more details.
   20 
   21 You should have received a copy of the GNU General Public License
   22 along with ANSIFilter.  If not, see <http://www.gnu.org/licenses/>.
   23 */
   24 
   25 #include "platform_fs.h"
   26 
   27 #include <sys/stat.h>
   28 
   29 using namespace std;
   30 
   31 namespace Platform {
   32 
   33 #ifdef _WIN32
   34     const char pathSeparator = '\\';
   35 #else
   36     const char pathSeparator = '/';
   37 #endif
   38 
   39 //-D_FILE_OFFSET_BITS=64
   40 //268435456 256 MB
   41 
   42 off_t fileSize(const string& fName) {
   43     struct stat fileInfo;
   44     if(stat(fName.c_str(), &fileInfo) != 0) {
   45         return 0;
   46     }
   47     return fileInfo.st_size;   
   48 }
   49 
   50 }
   51