|
i want exercise iostream also support the file's input and output,so write the little program below,but after compile ,note"error C2065: 'String' : undeclared identifier",can you help me to solve it?
the program function is:read word from a text file named "in_file",and write every word into a output file named "out_file" .
#include<iostream.h>
#include<fstream.h>
#include<string.h>
int main()
{
ofstream outfile("out_file");
ifstream infile("password");
if(!infile)
{
cerr<<"error:unable to open input file!\n";
return -1;
}
if(!outfile)
{
cerr<<"error:unable to open output file!\n";
return -2;
}
String word;
while (infile>>word)
outfile<
|
|
|
|
|
try
#include <string><br />
using namespace std;<br />
<br />
string word;
Regards,
Jijo.
________________________________
Yesterday is history,
Tomorrow is a mystery,
But today is a present.
|
|
|
|
|
yes,but when to use namespace?
in addition,why to note "unable to open input file",in_file is a txt created by notepad?
|
|
|
|
|
Reposting your includes:
#include <iostream.h>
#include <fstream.h>
#include <string.h> You have a few problems here. First, you are using the old iostream headers instead of the STL ones. Change them to <fstream> and <iostream> without the .h extension.
Also, string.h is the C library header with the C-style string functions. You want to #include <string>
Next, the type is string not String .
And finally, as the other post said, you need to use the std:: namespace name before the types because STL types are in that namespace.
More details on the iostream vs. STL headers here[^]
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
#include "witty-quote.h"
|
|
|
|
|
Using Visual C++ .net 2003, how would i put a .dll inside a .exe and have it run? Example Run.exe uses Running.dll to run, but i want it to be just the Run.exe with the running.dll inside of it? How would i do that? Also please give me detials on exactly how to do it.
|
|
|
|
|
do it the same way as sysinternal tools do. put the dll as resource into the exe file, extract it when running the program and load it dynamically then.
Don't try it, just do it!
|
|
|
|
|
Can you email me at mikeza123@comcast.net i need more info, im not to good at this. Tell me as if you were talking to a newb coder
|
|
|
|
|
I'm not your personal teacher, just an advicer.
Don't try it, just do it!
|
|
|
|
|
Hi all;
I am buidling an SDI application with a webbrowser control in the View Class. I had the control as public and i need to access it anywhere within my application. I was wandering how i could access a public variable in other classes (Eg webbrowser is found in View class and i need to access it in one of my dialog classes).
Could you please help me;
I'm really needing this
Thanks
|
|
|
|
|
|
Hi!
I want to make an anti-dialer program and I have to find out which program sends the command to open the dial-up connection...
Is it possible?
Thanks in advance!
Well... I am a beginner ...
|
|
|
|
|
Well...if your sig
Scolinks wrote:
Well... I am a beginner ...
is correct then your out of luck, cuz the solution ain't pretty...but you could possibly hook the TAPI and prevent access...not bullet proof, but it should stop programs like porn dialers from ever charging your phone bill long distance again
Cheers
How do I print my voice mail?
|
|
|
|
|
i want to customize the tacCtrl.so tabs of tabCtrl will appear at the centre of dialog.suugest me how can i get a tabCtrl with tabs on centre
|
|
|
|
|
Write a control from scratch...
How do I print my voice mail?
|
|
|
|
|
I am new to Visual C++ and i have to develop a Web Browser in it. pl hekp me how i can develop a full fledge web browser in Visual C++
.....
|
|
|
|
|
In Visual C++ editor menu; go to project->Insert Components and controls and choose to insert a Microsoft Webbrowser control. All you have to do now is create a variable for the web browser and you can access all the functionaliy of Microsof Internet Explorer 5. As easy as it gets...
Regards
Krugger
|
|
|
|
|
Gem1 wrote:
I am new to Visual C++ and i have to develop a Web Browser in it. pl hekp me how i can develop a full fledge web browser in Visual C++
How do I print my voice mail?
|
|
|
|
|
I would like to know how to display a JPG or high res BMP image on a MFC Dialog window.
|
|
|
|
|
|
|
You can use OleLoadPicturePath load the picture from a file, you'll get an IPicture then use the method Render to display it into a DC.
Or, check Dr. Yovav Gad's article CPicture - The Yovav (Horror) PictureShow
Fabian
|
|
|
|
|
Dear Friends,
I have to process the audio/video signal together after collecting the data from Video camera.
Anyone please write to me your valuable suggessions in this regard. Any kind of suggession related to such development(methods,technology etc) will help me a lot.
Thanks in advance.
Billar
|
|
|
|
|
Very interesting information I have to say...
Don't try it, just do it!
|
|
|
|
|
Dear Alexander
Will you please write to me something related to this. How?
Billar
|
|
|
|
|
Dear Alexander
Please write to How?
|
|
|
|