source: cpp/common/nonstd_stdio.h @ 109

Last change on this file since 109 was 109, checked in by sz, 10 years ago

source reorganization (see README)
new feature added: part/joint shapes (see frams/_demos/part_shapes.cpp)

  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1#ifndef _NONSTD_STDIO_H_
2#define _NONSTD_STDIO_H_
3
4bool fileExists(const char* path);
5bool removeFile(const char* path);
6
7#ifdef _WIN32
8
9
10#ifndef _MSC_VER
11 #include <dir.h>
12#else
13 #ifndef MOBILE2D
14 #include <direct.h>
15 #endif
16 #define mkdir _mkdir
17#endif
18
19#ifndef MOBILE2D
20 #include <io.h> //borland compiler: include <io.h> before <dir.h> causes the SimWorld class in "simul.h" be unrecognized, for unknown reason :O moreover, this problem is only pertinent to the CLI project, not GUI. Maybe this is caused by global defines like NOVCL, NO_STRICT etc.?
21 #define makeDirectory(name) mkdir(name)
22#endif
23
24
25#else
26
27 #include <unistd.h>
28 #include <sys/stat.h>
29 #define makeDirectory(name) mkdir(name,0777)
30 #define _unlink unlink //_unlink jest ISO-conformant, unlink jest POSIX-deprecated
31
32#endif
33
34
35#include <stdio.h>
36
37#if (defined SHP && defined BADA_API_1) || defined __ANDROID__
38
39#ifdef __ANDROID__
40#include <nv_file/nv_file.h>
41 struct rwFILE //jedno z dwoch pol jest zainicjowane w zaleznosci od tego gdzie jest plik
42 {
43        NvFile *rfile; //umie tylko czytac
44        FILE *rwfile;
45        rwFILE() {rfile=rwfile=NULL;}
46 };
47 typedef rwFILE MFILE;
48#else //SHP:
49 //z <stdio.h> wzielismy sprintfy i inne ktore dzia³aj¹...
50 #include <FIo.h>
51 // wklejone z sailora w ramach integracji frams+engine
52 // ale to nie sprawia ze framsy korzystaja z mfile - potrzebna jest implementacja virtfile dla bady! (patrz: stdiofile.h)
53 // i wtedy bedzie mozna mfile wywalic tez z sailora
54 typedef Osp::Io::File MFILE;
55#endif
56
57MFILE *mfopen(const char*path,const char*mode);
58void mfclose(MFILE *f);
59int mfread(void *ptr, int size, int n, MFILE *f);
60int mfwrite(const void *ptr, int size, int n, MFILE *f);
61int mfputs(const char *, MFILE *);
62int     mfseek(MFILE *, long, int);
63long mftell(MFILE *);
64char *mfgets(char *str, int num, MFILE *f);
65int mfeof(MFILE *f);
66
67//#define       SEEK_SET        0       /* set file offset to offset */
68//#define       SEEK_CUR        1       /* set file offset to current plus offset */
69//#define       SEEK_END        2       /* set file offset to EOF plus offset */
70//int   sprintf(char *, const char *, ...);
71//int   vsnprintf(char *,int, const char *, ...);
72
73#else
74 typedef FILE MFILE;
75 #define mfopen fopen
76 #define mfclose fclose
77 #define mfread fread
78 #define mfwrite fwrite
79 #define mfputs fputs
80 #define mfgets fgets
81 #define mfeof feof
82 #define mfseek fseek
83 #define mftell ftell
84#endif
85
86
87#ifndef _WIN32
88#define _strdup strdup //_strdup jest ISO-conformant, strdup jest POSIX deprecated
89#include <string.h> //strdup
90#endif
91
92#endif
Note: See TracBrowser for help on using the repository browser.