#include<iostream>
#include<fstream>
using namespace std;
int main()
{
ifstream stream1("D:\\file1.txt");
char a[80];
if(!stream1)
{
cout << "While opening a file an error is
encountered" << endl;
}
else
{
cout << "File is successfully opened" << endl;
}
while(!stream1.eof())
{
stream1 >> a;
cout << a << endl;
}
return(0);
}
OR
string line;
getline(stream1,line);
On Wed, Sep 7, 2011 at 7:51 PM, Anurag Gupta <[email protected]>wrote:
> @ kunal
>
> I was attempting this problem: http://www.spoj.pl/problems/NHAY/
> here,input size of haystick is not limited so,can you tell me how to
> read the
> haystick.
>
> On Sep 7, 12:06 am, Kunal Patil <[email protected]> wrote:
> > If I understand question correctly, then just read as many characters as
> you
> > can using standard string functions. (like fgets n all related)
> > Output these all characters in a file.
> > Iterate until you have read all the characters and go on appending what
> you
> > have read to file.
> > You intended to ask something else?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>
--
**Please do not print this e-mail until urgent requirement. Go Green!!
Save Papers <=> Save Trees
*BharatKumar Bagana*
**http://www.google.com/profiles/bagana.bharatkumar<http://www.google.com/profiles/bagana.bharatkumar>
*
Mobile +91 8056127652*
<[email protected]>
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.