Re: File copying




On 4 Feb 2011, at 22:57, Nader Morshed wrote:


you might want to take a look at GIO's GFileInfo API. It has a
large array of attributes to get/set, depending on the GIOModule being
used.


Thanks for the tip.  I've been experimenting with the GFileInfo API today but inadvertently, it's led me to 
something of a dead end.

Remember that apart from wanting to preserve certain file attributes, my main aim was to move some files into 
a new folder (i.e. creating a new file or overwriting an older version, then deleting the original).  
g_file_replace() seems to provide a handy interface for this type of operation, since it'll allow me to 
overwrite a pre-existing file in the destination folder or create a new one if the destination file didn't 
already exist.

g_file_replace() returns a GFileOutputStream* which (supposedly) I can use for writing new contents to the 
file.  However, I've been unable to find any examples of writing to a file using a GFileOutputStream*.  In 
fact, I can't find any read, write, flush. or, close functions that take a GFileOutputStream* as their input. 
 What am I missing here?  Am I supposed to turn my GFileOutputStream* into some other kind of stream (for 
example a GOutputStream*)?  I've found plenty of functions for using GOutputStream but am struggling with 
GFileOutputStream.  Thanks.

John


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