// Main.cpp
// count the numbers of the words
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream in("Main.cpp");
string str;
int lines = 0;
int words = 0;
while(getline(in, str))
{
string ::size_type pos = 0;
while((pos = str.find_first_of(' ', pos)) != string::npos)
{
pos++;
words++;
}
lines++;
words++;
}
cout << "lines of the file: " << lines << endl;
cout << "words of the file: " << words << endl;
return 0;
}
VC2005 BETA2 problem
I'm using VC2005 BETA2.
The code below is successfully compiled. But an error occurred when I ran it.
The error is: cannot find a file named MSVCP80D.dll
Is it because I am using a beta version?
I tried your code and it worked as expected. I have the VC2005 BETA2 as well. A few things to check:
1. Do you have the Windows XP SP2 Platform SDK installed? I doubt that it is required, but I have it and your code worked. Note that it is a 266MB download.
2. Did you have any problems installing the VC2005 beta2 product? Did everything go successfully?
3. Did you just make a Win32 Console project and use that code? Make sure you are not using managed C++ or .Net (C#)
Other than that, I'm not sure why that would happen. Try making a new project and see if it works. It could just be a beta 2 problem with something with your computer's configuration, but the code does work. Good luck!
1. Do you have the Windows XP SP2 Platform SDK installed? I doubt that it is required, but I have it and your code worked. Note that it is a 266MB download.
2. Did you have any problems installing the VC2005 beta2 product? Did everything go successfully?
3. Did you just make a Win32 Console project and use that code? Make sure you are not using managed C++ or .Net (C#)
Other than that, I'm not sure why that would happen. Try making a new project and see if it works. It could just be a beta 2 problem with something with your computer's configuration, but the code does work. Good luck!
I have serious install issues with Beta2. You might have the same problems. One of the new ones I'm having this try is that a .Net SaveFileDialog is throwing a ThreadStateException when I try to create it from a second thread (I made SURE to use SingleThreadApartment, but no dice). Works fine with .Net 2.0 Beta 1 installed.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement