problem with fstream

Discussion in 'C++' started by Nawaz, May 25, 2010.

  1. Nawaz

    Nawaz Guest

    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..
    Nawaz, May 25, 2010
    #1
    1. Advertising

  2. On 5/25/2010 12:16 PM, Nawaz wrote:
    > [..]
    >
    >
    > 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
    --
    I do not respond to top-posted replies, please don't ask
    Victor Bazarov, May 25, 2010
    #2
    1. Advertising

  3. Nawaz

    red floyd Guest

    On May 25, 9:38 am, Victor Bazarov <> wrote:
    > On 5/25/2010 12:16 PM, Nawaz wrote:
    >
    > > [..]

    >
    > > 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
    > --
    > I do not respond to top-posted replies, please don't ask


    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
    red floyd, May 25, 2010
    #3
  4. Nawaz

    red floyd Guest

    On May 25, 11:51 am, red floyd <> wrote:
    replies, please don't ask
    >
    > He's talking about file cursor.  And his solution is a FAQ.
    > Specifically
    > FAQ 15.5
    >
    > OP can find the FAQs athttp://www.parashift.com/c++-faq-lite


    Pardon me. That's *one* of his problems. Another is not using
    whitespace in a manner that makes his code readable, and yet
    another is not using meaningful variable names, or comments.
    red floyd, May 25, 2010
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. las

    fstream problem

    las, Jul 16, 2003, in forum: C++
    Replies:
    1
    Views:
    425
    Simon Saunders
    Jul 16, 2003
  2. jbruno4000

    Fstream problem

    jbruno4000, Nov 2, 2003, in forum: C++
    Replies:
    5
    Views:
    451
    =?ISO-8859-1?Q?Christian_Brechb=FChler?=
    Nov 3, 2003
  3. Brandon McCombs
    Replies:
    8
    Views:
    470
    Dave O'Hearn
    Nov 24, 2003
  4. Frédéric Manzanares

    problem with fstream

    Frédéric Manzanares, Nov 28, 2003, in forum: C++
    Replies:
    3
    Views:
    504
  5. Armando
    Replies:
    6
    Views:
    735
    Armando
    Jan 29, 2004
Loading...

Share This Page