fstream
-
I am trying to write a managed C++ extension to be used with a project I am working on. All seems to work well except that .NET seems to refuse to recognize any fstream members, and I can't instantiate it. I include it in the stdafx.h. Any help would be greatly appreciated.
-
I am trying to write a managed C++ extension to be used with a project I am working on. All seems to work well except that .NET seems to refuse to recognize any fstream members, and I can't instantiate it. I include it in the stdafx.h. Any help would be greatly appreciated.
This should work fine - in my simple test I #include <fstream>, then instantiate a fstream object. The types defined in fstream are in the std namespace. Does your code reflect this?
#include "stdafx.h"
#using #include #include using namespace System;
// This is the entry point for this application
int _tmain(void)
{
std::fstream fs;
fs.open("filename");// TODO: Please replace the sample code below with your own. Console::WriteLine(S"Hello World"); return 0;
}
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.
-
This should work fine - in my simple test I #include <fstream>, then instantiate a fstream object. The types defined in fstream are in the std namespace. Does your code reflect this?
#include "stdafx.h"
#using #include #include using namespace System;
// This is the entry point for this application
int _tmain(void)
{
std::fstream fs;
fs.open("filename");// TODO: Please replace the sample code below with your own. Console::WriteLine(S"Hello World"); return 0;
}
This posting is provided “AS IS” with no warranties, and confers no rights. You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.
Your code seems to work however, I am unsure of what file for the #using, I have tried the name of the built .dll in my case Test.dll, but I get the error "Could not find assembly Test.dll". Also if I include no filename, it expects one. I am new to Visual C++ .NET Managed Forums, and I would like to thank you for your patience.
-
Your code seems to work however, I am unsure of what file for the #using, I have tried the name of the built .dll in my case Test.dll, but I get the error "Could not find assembly Test.dll". Also if I include no filename, it expects one. I am new to Visual C++ .NET Managed Forums, and I would like to thank you for your patience.
Anonymous wrote: I am unsure of what file for the #using Nick didn't format it (;P), the following will need to be included for the source to work:
#include "stdafx.h"
#using <mscorlib.dll>
#include <tchar.h>
#include <fstream>
using namespace System;Nick Parker
May your glass be ever full. May the roof over your head be always strong. And may you be in heaven half an hour before the devil knows you’re dead. - Irish Blessing