statement with no effect [-Wunused-value]: > for (i==0;i<=100;i++){ format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘char **’ [-Wformat]: > fscanf(finp, "%s", &alst[i]); And in this case, you need to allocate char *arls[100] before using it.
As I already told you, this is a basic programming error but you event didn't notice it. So please find good C books and references out there and start learn how to write C program. Ardhan On Tue, Sep 11, 2012 at 5:32 AM, Rudra Banerjee <bnrj.ru...@yahoo.com> wrote: > Dear friends, > I am trying to learn using glib array. From the gtk documentation, I > managed to write this piece of code: > > #include <stdio.h> > #include <glib.h> > int main(int argc, char** argv) { > int i; > FILE *finp; > char *alst[100]; > GArray* a = g_array_new(FALSE, FALSE, sizeof(char*)); > finp=fopen("fauth","r"); > for (i==0;i<=100;i++){ > fscanf(finp, "%s", &alst[i]); > g_array_append_val(a, alst[i]); > printf("%s", g_array_index(a, char*, i)); > } > printf("There are now %d items in the array\n", a->len); > g_array_free(a, FALSE); > return 0; > } > > while compiling, its giving warning: > $ gcc -Wall auc.c `pkg-config --cflags --libs gtk+-3.0` > auc.c: In function ‘main’: > auc.c:9:1: warning: statement with no effect [-Wunused-value] > auc.c:10:9: warning: format ‘%s’ expects argument of type ‘char *’, but > argument 3 has type ‘char **’ [-Wformat] > > Can you kindly help me detecting the error? > Typical file that I am using is: > Taylor, DW, > {\textbf{Banerjee, Rudra}} and Mookerjee, Abhijit and Sanyal, > Biplab, > {\textbf{R. Banerjee}} and Banerjee, M. and Majumdar, AK and > Mookerjee, A. and Sanyal, B. and Hellsvik, J. and Eriksson, O. and > Nigam, AK, > {\textbf{Rudra Banerjee}} and Mookerjee, Abhijit, > {\textbf{Rudra Banerjee}} and Mookerjee, Abhijit, > Gyorffy, B. L. and Pindor, A. J. and Staunton, J. and Stocks, > G. M. > and Winter, H., > Abdul-Razzaq, W. and Kouvel, JS, > Aitken, RG and Cheung, TD and Kouvel, JS and Hurdequint, H., > Alam, A. and Mookerjee, A., > Alam, A. and Mookerjee, A., > > > > > _______________________________________________ > gtk-app-devel-list mailing list > gtk-app-devel-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list -- Please do not send me any propriety format such as Microsoft Offices: Word, Excel, Power Point, etc. Please use standard non-propriety format such as plain text, HTML, PDF or OpenOffices format. _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list