On Thu, Feb 09, 2017 at 03:24:53PM +0500, MUHAMMAD MOHSIN wrote:
> * but it returns following error (error: copy_device_to_file: unknown
> option 689330304 (this can happen if a program is compiled against a newer
> version of libguestfs, then dynamically linked to an older version)).
> Please see attached main.c for my sample code.
I don't know about the above error, but the way you've used
copy-device-to-file is clearly wrong:
> guestfs_mount (g, "/dev/sda1", "/");
>
> //guestfs_mount_local (g, "/home/mohsin/VHD/");
> guestfs_ls(g, "/");
> guestfs_copy_device_to_file(g, "/dev/sda1/file-to extract.exe", "/abc.exe");
It's actually not clear to me what you're trying to achieve here.
Download the file to the local host? If so use guestfs_download:
guestfs_download (g, "/file-to-extract.exe", "local-file.exe");
BTW you should check for errors from C API calls.
http://libguestfs.org/guestfs.3.html#downloading
http://libguestfs.org/guestfs.3.html#error-handling
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html