0
votes

I'm trying a tutorial on glib which uses GIOChannel. I'm using Ubuntu 11.04 (Natty Narwhal) with glib-2.30.2 (gtk+-3.2.3) and C code.

The code is from here: http://library.developer.nokia.com/index.jsp?topic=/GUID-E35887BB-7E58-438C-AA27-97B2CDE7E069/GUID-817C43E8-9169-4750-818B-B431D138D71A.html

The program runs but I the contents of my source test file is not copied to the destination file. I'm not receiving any error or warning messages. The program just does nothing. What's wrong here?

1
The program runs perfectly for me. Are you sure you typed it in properly? - ptomato
I created 2 files in the same folder, test2.txt with nothing in it and test1.txt containing the words: "text here" When the program runs I get: usage:<cp SOURCE> <DESTINATION> then on the next line: Press any key to exit. I enter: cp test1.txt test2.txt and press enter. It just returns to the prompt and doesn't copy the contents of test1.txt to test2.txt. I don't get any warnings about file permissions. Strangely, if I enter a file that doesn't exist it doesn't show any errors! - mike
Are you sure you typed the program in properly? - ptomato
I just copied and pasted so yes it's correct. - mike
If someone could help I would really appreciate it. - mike

1 Answers

0
votes

Works now, I changed the line:

g_print("usage:<cp SOURCE> <DESTINATION>\n");

To:

g_print("usage: %s <SOURCE> <DESTINATION>\n", argv[0]);

Then compiled it using:

gcc -Wall $(pkg-config --cflags gio-2.0) -c io.c

gcc -Wall $(pkg-config --libs gio-20) -o io io.o 

Run the program using: ./io io.c new_io.c