source: trunk/src/io/c_file_system.cc @ 128

Last change on this file since 128 was 128, checked in by epyon, 12 years ago
  • bad cast in image.cc fixed
  • bug in c_file_system fixed
File size: 820 bytes
RevLine 
[124]1// Copyright (C) 2012-2013 Kornel Kisielewicz
2// This file is part of NV Libraries.
3// For conditions of distribution and use, see copyright notice in nv.hh
4
5#include <cstdio>
6#include "nv/io/c_file_system.hh"
7#include "nv/io/c_stream.hh"
8
9using namespace nv;
10
11c_file_system::c_file_system()
12{
13
14}
15
16c_file_system::~c_file_system()
17{
18
19}
20
21bool c_file_system::exists( const char* fpath )
22{
23        FILE* file = ::fopen( fpath, "rb" );
24        if ( !file )
25        {
26                return false;
27        }
28        ::fclose( file );
29        return true;
30}
31
32stream* c_file_system::open( const char* fpath, const char* fmode /*= "rb" */ )
33{
[128]34        NV_ASSERT( fpath != nullptr && fmode != nullptr, "Bad parameters passed to open" );
[124]35        FILE* file = ::fopen( fpath, fmode );
36        if ( !file )
37        {
38                return nullptr;
39        }
40        return new c_stream( file, fpath );
41}
Note: See TracBrowser for help on using the repository browser.