equal
deleted
inserted
replaced
28 #include <stdlib.h> |
28 #include <stdlib.h> |
29 #include <errno.h> |
29 #include <errno.h> |
30 |
30 |
31 #include "h_utl.h" |
31 #include "h_utl.h" |
32 |
32 |
33 TInt HFile::Open(const TText * const aFileName, TInt32 * const aFileHandle) |
33 TInt HFile::Open(const char* aFileName, TInt32 * const aFileHandle) |
34 { |
34 { |
35 #ifdef __LINUX__ |
35 #ifdef __LINUX__ |
36 TInt32 hFile = open((const char *)aFileName, O_RDONLY ); |
36 TInt32 hFile = open(aFileName, O_RDONLY ); |
37 #else |
37 #else |
38 TInt32 hFile = _open((const char *)aFileName, _O_RDONLY | _O_BINARY); |
38 TInt32 hFile = _open(aFileName, _O_RDONLY | _O_BINARY); |
39 #endif |
39 #endif |
40 |
40 |
41 if (hFile == -1) |
41 if (hFile == -1) |
42 { |
42 { |
43 switch (errno) |
43 switch (errno) |
93 TUint32 pos = _lseek(aFileHandle, 0, SEEK_CUR); |
93 TUint32 pos = _lseek(aFileHandle, 0, SEEK_CUR); |
94 return pos; |
94 return pos; |
95 } |
95 } |
96 |
96 |
97 /******************************************************************************/ |
97 /******************************************************************************/ |
98 TUint32 HFile::GetLength(TText *aName) |
98 TUint32 HFile::GetLength(const char* aName) |
99 { |
99 { |
100 TInt32 handle; |
100 TInt32 handle; |
101 if (HFile::Open(aName, &handle)==0) |
101 if (HFile::Open(aName, &handle)==0) |
102 { |
102 { |
103 TUint32 size = _filelength(handle); |
103 TUint32 size = _filelength(handle); |
123 _close(aFileHandle); |
123 _close(aFileHandle); |
124 } |
124 } |
125 |
125 |
126 |
126 |
127 /******************************************************************************/ |
127 /******************************************************************************/ |
128 TUint32 HFile::Read(TText *aName, TAny *someMem) |
128 TUint32 HFile::Read(const char* aName, TAny *someMem) |
129 { |
129 { |
130 TInt32 handle; |
130 TInt32 handle; |
131 if (HFile::Open(aName, &handle)==0) |
131 if (HFile::Open(aName, &handle)==0) |
132 { |
132 { |
133 TUint32 size = HFile::GetLength(handle); |
133 TUint32 size = HFile::GetLength(handle); |