Re: GLIB IO Channels problem



s88 wrote:
Hello guys:
     As I using the GLIB IO Channels, I meet some problem. I wanna use
the IO Channels write  a large memory into the file. Follows is my
code segment...
...
FILE* mem_dump = fopen("MEM_DUMP.txt","w");
guint bytes = 0 , tmp = 0;
...
elf_pt = g_malloc0(59397);
GIOChannel* gioc = g_io_channel_unix_new((int)mem_dump);

Heh, you cant do that :)

A FILE pointer and an integer file desctiptor is not the same thing,
on some (most) systems; you will be able to do:
    g_io_channel_unix_new(mem_dump->_fileno)

But it would be better if you just did g_io_channel_new_file() ;-)
(if for some reason, you must use an fd; dont use fopen, use g_open
with the unix `open' syntax instead, I think its somwhat less portable
though).

Cheeers,
                            -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]