source: cpp/frams/virtfile/stdiofile.cpp @ 151

Last change on this file since 151 was 121, checked in by sz, 11 years ago

updated file headers and makefiles

  • Property svn:eol-style set to native
File size: 1.1 KB
Line 
1// This file is a part of the Framsticks GDK.
2// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#include "stdiofile.h"
6#include <common/nonstd_dir.h>
7#include <common/nonstd_stdio.h>
8#include <common/framsg.h>
9
10VirtFILE* StdioFileSystem::Vfopen(const char* path,const char*mode)
11{
12        //printFM("Vfopen %s %s",path,mode);
13        FILE *f=fopen(path,mode);
14        //printFM("%p",f);
15        if (f) return new StdioFILE(f,path); else return 0;
16}
17
18VirtDIR* StdioFileSystem::Vopendir(const char* path)
19{
20        //printFM("Vopendir %s",path);
21        DIR *d=opendir(path);
22        //printFM("%p",d);
23        if (d) return new StdioDIR(d); else return 0;
24}
25
26int StdioFileSystem::Vfexists(const char* path)
27{
28        return fileExists(path);
29}
30
31void StdioFILE::setStdio()
32{
33        static StdioFILEDontClose si(stdin);
34        static StdioFILEDontClose so(stdout);
35        static StdioFILEDontClose se(stderr);
36        setVstdin(&si);
37        setVstdout(&so);
38        setVstderr(&se);
39}
40
41dirent* StdioDIR::Vreaddir()
42{
43        //printFM("Vreaddir %s",dir);
44        return readdir(dir);
45}
Note: See TracBrowser for help on using the repository browser.