• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

C++ Style file streams in Visual C#?

PowerMacG5

Diamond Member
Is that possible? I want to write a simple program in VC++ (using MFC), and want to use file streams. Is there any way to use C++ style file streams? As I really do not prefer the CFile objects.

EDIT: Now that I have it working in VC++, can I use C++ style file streams in VC#?
 
VC++ allows you to write regular C++ code. You do not have to write any Windows-specific or VC++ specific code. Just include the appropriate libs like you would with C++.
 
Yes, but I cannot get it to work like C++ style file streams. I want it to take the file, and input the integer up to the white space. It isn't feasable for me to make it one number per line, which works, I need to be able to do it like I do on C++.
 
Originally posted by: KraziKid
Yes, but I cannot get it to work like C++ style file streams. I want it to take the file, and input the integer up to the white space. It isn't feasable for me to make it one number per line, which works, I need to be able to do it like I do on C++.

I don't quite grok what you're saying. You want to take a file, input an integer up to a white space? Can you expound a bit?

For what it's worth, you can still use C++ under .NET. C++ under .NET is called managed C++. You can mix unmanaged (i.e. "regular") C++ and managed C++ in the same project and/or file. You could then have your managed C++ methods call you unmanaged C++ methods which call the file streams you so love.

The only way for C# to access these streams is for you to develop a native library in C++ and export the appropriate functions. You'd then use the platform invocation facilities of .NET to load the native library into your C# app and call the methods.

I really don't think it's necessary, but you need to expound on your requirements.
 
Back
Top