Passing 'const char *' to parameter of type 'char *' discards qualifiers

c, c++, gcc-warning, objective-c

Solution

As in the `miniunz.c` file from Zip Code.

The function definition is as follows:

int makedir (newdir)
    char *newdir; 

So by considering that, There are two ways to do this.

  char* write_filename;

              fopen((char*)write_filename,"wb");
                 makedir(write_filename);

OR

  const char* write_filename;

              fopen(write_filename,"wb");
                 makedir((char*)write_filename);

Or Check your `makedir()` function.

Hope this will help you.

Problem

I am getting warning: miniunz.c:342:25: Passing 'const char *' to parameter of type 'char *' discards qualifiers in miniunz.c file of the Zip Archive library. Specifically: ``` const char* write_filename; fopen(write_filename,"wb"); //// This work fine........... makedir(write_filename); //// This line shows warning.... ``` How should this warning be removed so that both work fine?

Original source