problem with fstream

N

Nawaz

int search(int &j){
string take,get1,get3;

int f=0;


for(;f!=2;){
system("cls");
print();
cout<<"1. For Search"<<endl;
cout<<"2. Go Back"<<endl<<endl;
cout<<"Enter Any Above NO : ";
scanf("%d",&f);


if(f==1){
fstream se;
se.open ("SiS.txt");

se.seekg(0,ios::beg);

int i=0,k=0,h=0,n=0,l=0;
cout<<"Search by NAME Press 0"<<endl<<endl;
cout<<"Search by ID Press 1"<<endl<<endl;
cout<<"Enter NO : ";

scanf("%d",&l);
se.seekg(0,ios::beg);
char ch;
while(!(se.eof())){
se.get(ch);
take[k]=ch;k++;}
take[k]='^';

if (l==0){
cout<<"Enter Name For Search : ";
getline(cin,get3);
getline(cin,get1);

while(take[j]!='^' && get1!='\x0'){
while(take[j]!='^' && get1!='\x0'){
if(get1==take[j]){i+=1;j+=1;break;}
else if (get1!=take[j]){i=0;j+=1;break;}
}}

for(;take[j]!='~';j--){}

int g=j+=1;
while(take[g]!='/'){
for(;take[g]!='?'&& take[g]!='/';g++)
{
cout<<take[g];}
if (take[g]=='/'){cout<<endl<<endl;break;}
cout<<endl;g+=1;}se.close();}
}



when .exe has open and this function would call then in first
iteration of loop "for", the curser is at beginning but after 2nd
iteration it is at end of file so while open ".exe " how i take curser
at beginning .

please answer as soon as possible

and thanks for answer..
 
V

Victor Bazarov

[..]


when .exe has open and this function would call then in first
iteration of loop "for", the curser is at beginning but after 2nd
iteration it is at end of file so while open ".exe " how i take curser
at beginning .

If you're asking about manipulation of the screen and some solution to
place the screen cursor to a particular position, then C++ has nothing
to offer. Screen manipulation is not a part of the language, nor is it
a part of the standard library. You need to use OS-specific library for
that. Google for 'ncurses'.

V
 
R

red floyd

when .exe has open and this function would call then in first
iteration of loop "for", the curser  is at beginning but after 2nd
iteration it is at end of file so while open ".exe " how i take curser
at beginning  .

If you're asking about manipulation of the screen and some solution to
place the screen cursor to a particular position, then C++ has nothing
to offer.  Screen manipulation is not a part of the language, nor is it
a part of the standard library.  You need to use OS-specific library for
that.  Google for 'ncurses'.

V

He's talking about file cursor. And his solution is a FAQ.
Specifically
FAQ 15.5

OP can find the FAQs at http://www.parashift.com/c++-faq-lite
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top