0

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?

mike
  • 1,135
  • 4
  • 22
  • 39
  • The program runs perfectly for me. Are you sure you typed it in properly? – ptomato Jun 29 '12 at 09:13
  • 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: 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 Jun 29 '12 at 18:20
  • Are you sure you typed the program in properly? – ptomato Jun 30 '12 at 00:01
  • I just copied and pasted so yes it's correct. – mike Jun 30 '12 at 05:23
  • If someone could help I would really appreciate it. – mike Jul 03 '12 at 23:39
  • @mike, do you still need help? – Yasushi Shoji Aug 17 '12 at 19:55

1 Answers1

0

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

mike
  • 1,135
  • 4
  • 22
  • 39