• Advertisement

Archived

This topic is now archived and is closed to further replies.

Converting VC++ 6.0 to .NET

This topic is 5154 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a program, in VC++ 6.0 Introductory Edition, that wrote out a file. I used another program written with the same compiler to load them up(it was a game). I have not finished the game, but am going to finish it in VC++ .NET Standard Edition. I used the following code to load the file up:
// open next level and load it in

int grid[400];
char filename[100];
memset(grid,0,sizeof(grid));
sprintf(filename,"Media//LEVEL%d",level);

ifstream fin(filename,ios::binary);
fin.read((char*)&grid,sizeof(grid));
fin.close();
However it doesn't work, and I get the following errors:
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(613) : error C2065: 'ifstream' : undeclared identifier
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(613) : error C2146: syntax error : missing ';' before identifier 'fin'
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(613) : error C2653: 'ios' : is not a class or namespace name
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(613) : error C2065: 'binary' : undeclared identifier
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(613) : error C3861: 'fin': identifier not found, even with argument-dependent lookup
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(614) : error C2228: left of '.read' must have class/struct/union type
        type is ''unknown-type''
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(614) : error C3861: 'fin': identifier not found, even with argument-dependent lookup
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(615) : error C2228: left of '.close' must have class/struct/union type
        type is ''unknown-type''
c:\LukeTech Files\Games\Weekly\Breakout\main.cpp(615) : error C3861: 'fin': identifier not found, even with argument-dependent lookup
I have included the same header files. I appreciate any help on this topic. Being that I am human, I am prone to (MANY)mistakes. Check everything I post with Google, etc. -- Chronic sufferer of OCD [edited by - Luke Thompson on January 11, 2004 5:00:14 PM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Change "ifstream" to "std::ifstream", "ios::binary" to "std::ios::binary", and all should be well. Alternately, add "using namespace std;" to the top of the file should work.

Share this post


Link to post
Share on other sites
Thank you. It works.

Being that I am human, I am prone to (MANY)mistakes.
Check everything I post with Google, etc.

-- Chronic sufferer of OCD

[edited by - Luke Thompson on January 12, 2004 6:17:04 AM]

Share this post


Link to post
Share on other sites

  • Advertisement