[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Posrting fstream from VC6 to Visual Studio 2005

Posted on 2007-03-22
3
Medium Priority
?
862 Views
Last Modified: 2013-11-27
Hi, I am trying to compile a working C++ file under Visual Studio 2005 (With SP1). It was earlier complaining about fstream.h. So I changed it to include <fstream> instead of the fstream.h. Now it gives me hundreds of errors like "Error      1      error C2146: syntax error : missing ';' before identifier 'source' etc  at the line where I have declared ifstream and ofstream.

Any help is appreciated

Thanks you,
skarve
0
Comment
Question by:skarve_Dev
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 1920 total points
ID: 18769630
You should add

using namespace std;

below your include statement in the cpp. In the header files add prefix std:: to any occurence of ifstream and ofstream.
0
 
LVL 39

Assisted Solution

by:itsmeandnobodyelse
itsmeandnobodyelse earned 1920 total points
ID: 18769639
Note if changing to <fstream> you need to change to <iostream>, <iomanip>, <sstream> as well. Here applies the same regarding the std:: prefix. Note the string stream classes have changed to istringstream and ostringstream. They are based on std::string == std::basic_string<char>, so you most likely have to relace <string.h> by <string> as well what is recommended anyway but may cause some more porting issues.

Regards, Alex
0
 
LVL 11

Assisted Solution

by:Deepu Abraham
Deepu Abraham earned 80 total points
ID: 18770155
May be this will give you some more input:
http://www.cplusplus.com/ifstream
Best Regards,
DeepuAbrahamK
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question