Pointer Question

Discussion in 'C++' started by Songmuh, Nov 5, 2006.

  1. Songmuh

    Songmuh Guest

    I'm trying to use the InfoZIP by calling its main fucntion. When it's first
    called, everything works. The second call with the same command except for
    the zip filename failed with the error: zip error: Nothing to do!.

    I've looked at the source code and found the problematic line of code that
    caused this issue. It happens when a local structure is assigned to a global
    structure pointer.
    (in the fileio.c file) as follows:

    strcpy(f->name, name);
    f->iname = iname;
    f->zname = zname;
    f->dosflag = dosflag;
    *fnxt = f; // This is the problematic line


    where *fnxt is defined as

    struct flist far * far *fnxt = &found;

    and f is a local structure defined as

    struct flist far *f;

    I did a printf before and after each line and found that the value of found
    is turned into 0 when the code is called the second time.

    Any help will be appreciated.
    Songmuh, Nov 5, 2006
    #1
    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. Replies:
    10
    Views:
    673
    Chris Torek
    Feb 4, 2005
  2. jimjim
    Replies:
    16
    Views:
    824
    Jordan Abel
    Mar 28, 2006
  3. Replies:
    4
    Views:
    1,233
    Fred Zwarts
    Jul 2, 2009
  4. A
    Replies:
    7
    Views:
    626
  5. , India

    pointer to an array vs pointer to pointer

    , India, Sep 20, 2011, in forum: C Programming
    Replies:
    5
    Views:
    445
    James Kuyper
    Sep 23, 2011
Loading...

Share This Page