g_open() is wrapper to open() syscall, not the standard libc's fopen().

> mkbib.c:114:15: warning: initialization makes pointer from integer
> without a cast [enabled by default]
You got this because g_open() returning a int (file descriptor) not a
FILE pointer.

You must distinguish each I/O method that you are using and don't mess with it.
You can't use a file descriptor to standard libc's I/O functions, use
FILE pointer instead.

#include <glib.h>
#include <glib/gstdio.h>
#include <stdio.h>

FILE *fop = open("bib2.bib", "w");
/* you can call g_fprintf() or fprintf() */

see man 3 printf

> Is it possible to write to a file using g_print?
g_print() already write to standard output FILE, but you can dup()
standard output to another file.

Regards.

On Wed, Aug 22, 2012 at 6:42 AM, Rudra Banerjee <bnrj.ru...@yahoo.com> wrote:
> Is it possible to write to a file using g_print?
> I was trying something like:
>
>   FILE *fop = g_open("bib2.bib","w");
>   g_print ("%s%s",strcombo,strkey, fop);
>
> but its not working.
> Even fprintf is giving warning and not writing.
> mkbib.c:114:15: warning: initialization makes pointer from integer
> without a cast [enabled by default]
> mkbib.c:115:3: warning: passing argument 1 of ‘fprintf’ from
> incompatible pointer type [enabled by default]
>
> Any solution?
>
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to