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

Last change on this file since 247 was 227, checked in by Maciej Komosinski, 10 years ago

Android compilation and access to RESOURCES and HOME files

  • 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) 1999-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#ifdef USE_MFILE
14        MFILE *f=mfopen(path,mode);
15#else
16        FILE *f=fopen(path,mode);
17#endif
18        //printFM("%p",f);
19        if (f) return new StdioFILE(f,path); else return 0;
20}
21
22VirtDIR* StdioFileSystem::Vopendir(const char* path)
23{
24        //printFM("Vopendir %s",path);
25        DIR *d=opendir(path);
26        //printFM("%p",d);
27        if (d) return new StdioDIR(d); else return 0;
28}
29
30int StdioFileSystem::Vfexists(const char* path)
31{
32        return fileExists(path);
33}
34
35void StdioFILE::setStdio()
36{
37#ifndef NO_STD_IN_OUT_ERR
38        static StdioFILEDontClose si(stdin);
39        static StdioFILEDontClose so(stdout);
40        static StdioFILEDontClose se(stderr);
41        setVstdin(&si);
42        setVstdout(&so);
43        setVstderr(&se);
44#endif
45}
46
47dirent* StdioDIR::Vreaddir()
48{
49        //printFM("Vreaddir %s",dir);
50        return readdir(dir);
51}
Note: See TracBrowser for help on using the repository browser.