Welcome to Dream.In.Code
Become a C++ Expert!

Join 149,916 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,113 people online right now. Registration is fast and FREE... Join Now!




ifstream with add |more or less function

 
Reply to this topicStart new topic

ifstream with add |more or less function, additional function view text files

budi_07
1 Feb, 2008 - 08:25 AM
Post #1

New D.I.C Head
*

Joined: 1 Feb, 2008
Posts: 2

i hope you can additional source code to my c++ file.... with additional function ...like option | more in dos console...to view text file very long text....
and my program work with ferpectly..

plzz

#include <iostream.h>
#include <conio.h>
#include <string.h>
#include <fstream.h>
#pragma hdrstop


//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{
string hj;
ifstream jk ("e:/bd.txt");
if(jk.is_open()){
while(!jk.eof()){
getline(jk,hj);
cout<<hj<<endl;
}
jk.close();
}else{
cout<<"file eror"<<endl;
}
getch();

return 0;
}

This post has been edited by budi_07: 1 Feb, 2008 - 08:37 AM
User is offlineProfile CardPM
+Quote Post

Jingle
RE: Ifstream With Add |more Or Less Function
1 Feb, 2008 - 11:54 AM
Post #2

D.I.C Regular
***

Joined: 20 Oct, 2007
Posts: 250


My Contributions
#include <iostream.h>
works but is considered depreciated(old) "Deprecated" (thanks for catching that)
it is advised to use

#include <iostream>
using namespace std;

what compiler are you using?

This post has been edited by Jingle: 1 Feb, 2008 - 12:57 PM
User is offlineProfile CardPM
+Quote Post

bella_nella90
RE: Ifstream With Add |more Or Less Function
1 Feb, 2008 - 12:28 PM
Post #3

New D.I.C Head
*

Joined: 1 Feb, 2008
Posts: 3

QUOTE(budi_07 @ 1 Feb, 2008 - 09:25 AM) *

i hope you can additional source code to my c++ file.... with additional function ...like option | more in dos console...to view text file very long text....
and my program work with ferpectly..

plzz

#include <iostream.h>
#include <conio.h>
#include <string.h>
#include <fstream.h>
#pragma hdrstop


//---------------------------------------------------------------------------

#pragma argsused
int main(int argc, char* argv[])
{
string hj;
ifstream jk ("e:/bd.txt");
if(jk.is_open()){
while(!jk.eof()){
getline(jk,hj);
cout<<hj<<endl;
}
jk.close();
}else{
cout<<"file eror"<<endl;
}
getch();

return 0;
}


wtf is this place like a nerd place or somen just wondering cuz i was lookin for a myspace proxy and this shit came on ? blink.gif

User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Ifstream With Add |more Or Less Function
1 Feb, 2008 - 12:30 PM
Post #4

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,351



Thanked: 51 times
Dream Kudos: 25
My Contributions
QUOTE(Jingle @ 1 Feb, 2008 - 02:54 PM) *

#include <iostream.h>
works but is considered deteriorated(old)


Deprecated.

One should always use C++ standards, including namespaces as opposed to the old header files.

QUOTE(bella_nella90 @ 1 Feb, 2008 - 03:28 PM) *



wtf is this place like a nerd place or somen just wondering cuz i was lookin for a myspace proxy and this shit came on ? blink.gif

Maybe you should be looking in the foolish myspace question forum instead of the c/c++ forum.
User is offlineProfile CardPM
+Quote Post

budi_07
RE: Ifstream With Add |more Or Less Function
2 Feb, 2008 - 04:05 AM
Post #5

New D.I.C Head
*

Joined: 1 Feb, 2008
Posts: 2

QUOTE(Jingle @ 1 Feb, 2008 - 12:54 PM) *

#include <iostream.h>
works but is considered depreciated(old) "Deprecated" (thanks for catching that)
it is advised to use

#include <iostream>
using namespace std;

what compiler are you using?


Thanks for your correct..
i will usually to type coding like your advice...

i use BCC32 (borland c++ builder 6.0)..

whats wrong with the compiler ...?

i hope you can soon to be give solution ..

sorry for my english too bad..

in other case i found the trouble..

the case like this...(

#include <iostream>
#inlude <conio>
using namespace std;

int main (void)
{
int var_1;
cout<<"Please insert your Number..! :";
cin>>var_1;
cout<<" Inch"<<endl;
cout<<"Results..:"<<var_1<<endl;

getch();
return 0;
}


=============
Please insert your Number..! :100
Inch
Results..:100
===================

I Want To Change Your Final Result Like This..

=============
Please insert your Number..! :100 Inch
Results..:100
==============

Would You Help Me Please....!!
i'm a Beginner

thanks

boedi




Thanks for your correct..
i will usually to type coding like your advice...

i use BCC32 (borland c++ builder 6.0)..

whats wrong with the compiler ...?

i hope you can soon to be give solution ..

sorry for my english too bad..

in other case i found the trouble..

the case like this...(

#include <iostream>
#inlude <conio>
using namespace std;

int main (void)
{
int var_1;
cout<<"Please insert your Number..! :";
cin>>var_1;
cout<<" Inch"<<endl;
cout<<"Results..:"<<var_1<<endl;

getch();
return 0;
}


=============
Please insert your Number..! :100
Inch
Results..:100
===================

I Want To Change Your Final Result Like This..

=============
Please insert your Number..! :100 Inch
Results..:100
==============

Would You Help Me Please....!!
i'm a Beginner

thanks

boedi



User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 1/8/09 02:22PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month