He says std dosn't exist, do i need to include any header or lib?
Thanks
open file dialog
-
- Posts: 118
- Joined: Thu Sep 18, 2003 10:05 pm
- Location: switzerland
Ah, well... you need to include some standard template library (STL) stuffCleves wrote:He says std dosn't exist, do i need to include any header or lib?
in windows under visual studio 2003 i need to include
#include <string> // for std::string
#include <locale> // for std::locale
#include <fstream> // for output stream
just look in the docu of your system,
or google for standard template library.
if you need to get a char* just use the method ".c_str()" of the string object (took me a while to find that when i was new to STL).
if you don't have a compliant compiler there is an STL porting project at www.stlport.com
btw, stl uses std as namespace. (what a beauty , i just love cryptic phrases)
cheers
gorgon
-
- Posts: 118
- Joined: Thu Sep 18, 2003 10:05 pm
- Location: switzerland
if you want to have byte-characters to work with then I'm afraid there isn't any shorter way (But I could be wrong )Cleves wrote:Well it seems to work but dosn't there any easier way doing that?
if you just want to output the filename a shorter method would be to use
a 'std::wofstream'
Code: Select all
#include <fstream>
...
std::wofstream appLog;
wchar_t* msg=L"hello unicode world";
// note: 'wchar_t' is a type def for 'unisgned short' !
...
appLog.open("applog.txt");
...
// write some text stored in msg
appLog<< msg;
...
gorgon
Well, you would first want to make sure your file exists as it may be a path problem. C++ can set a different working directory as compared to where the application is run from.
if (device->getFileSystem()->existFile("output.txt") {
}
or it might be somewhere else
if (device->getFileSystem()->existFile("c:\output.txt") {
}
The second would be "Is your read buffer, which you call filename, large enough to hold 100 characters or is there any other problems related to it?"
if (device->getFileSystem()->existFile("output.txt") {
}
or it might be somewhere else
if (device->getFileSystem()->existFile("c:\output.txt") {
}
The second would be "Is your read buffer, which you call filename, large enough to hold 100 characters or is there any other problems related to it?"
Code: Select all
virtual s32 irr::io::IReadFile::read ( void * buffer,
s32 sizeToRead
) [pure virtual]
Reads an amount of bytes from the file.
Parameters:
buffer: Pointer to buffer where to read bytes will be written to.
sizeToRead: Amount of bytes to read from the file.
Returns:
Returns how much bytes were read.
Crud, how do I do this again?