source: cpp/gdk/stdiofile.cpp @ 50

Last change on this file since 50 was 5, checked in by sz, 16 years ago

added the GDK (Genotype Development Kit)

File size: 908 bytes
Line 
1// This file is a part of Framsticks GDK library.
2// Copyright (C) 2002-2006  Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.frams.alife.pl/ for further information.
4
5#include "stdiofile.h"
6#include "nonstd.h"
7#include "nonstd_io.h"
8
9VirtFILE* StdioFileSystem::Vfopen(const char* path,const char*mode)
10{
11FILE *f=fopen(path,mode);
12if (f) return new StdioFILE(f,path); else return 0;
13}
14
15VirtDIR* StdioFileSystem::Vopendir(const char* path)
16{
17#ifndef _MSC_VER
18DIR *d=opendir(path);
19if (d) return new StdioDIR(d); else
20#endif
21return 0;
22}
23
24int StdioFileSystem::Vfexists(const char* path)
25{return fileExists(path);}
26
27void StdioFILE::setStdio()
28{
29static StdioFILEDontClose si(stdin);
30static StdioFILEDontClose so(stdout);
31static StdioFILEDontClose se(stderr);
32setVstdin(&si);
33setVstdout(&so);
34setVstderr(&se);
35}
36
37#ifndef _MSC_VER
38dirent* StdioDIR::Vreaddir()
39{
40return readdir(dir);
41}
42#endif
Note: See TracBrowser for help on using the repository browser.