glib array help
- From: Rudra Banerjee <bnrj rudra yahoo com>
- To: gtk devel <gtk-app-devel-list gnome org>
- Subject: glib array help
- Date: Mon, 10 Sep 2012 23:32:19 +0100
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.,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]