1

As per my understanding there is an option called Shared Folder. But I am not referring to that. Here my Guest OS is Linux and my Host OS is windows. I am using virtualbox to run the Guest OS. I need to run a simple application(C/C++) in the Linux which is running in the virtualbox.

The function syntax can be something like below

fun_copy(file_from_host_os,dest_path_guest_os)
{
  //Implementation
}

Here:

  • file_from_host_os: The file (eg: foo.txt) present inside the windows directory.
  • dest_path_guest_os - Location of the destination path(eg: /home/) inside the linux (running in the virtualbox)

I am a newbie into this forum. Correct me if something is wrong from side. Thanks in advance.

| improve this question | | | | |
  • Is the overall goal to transfer data from the Windows host to the Linux guest? In that case something like pscp or psftp from Windows may be useful. If this is a C or C++ programming question, it may be better suited on the StackOverflow site. – Kusalananda Jan 8 at 7:39
  • @kusalananda : Is it possible to link this question to StackOverflow site or do I need to ask the same question there ? – Vishnu CS Jan 8 at 7:45
  • 1
    The fact that the Linux host is a VirtualBox guest is not relevant. The answer would be the same if it had been a separate physical machine, so you might as well remove all mentionings of VirtualBox and shared folders. It is still not clear to me whether the topic of this question is "How do I write C or C++ code to transfer a file?" (a programming question possibly relevant on StackOverflow, but see stackoverflow.com/help/on-topic) or "How may I transfer a file (by any means)?" (a question possibly relevant to this site, or to the SuperUser site). – Kusalananda Jan 8 at 8:01
  • 1
    Is sharing a network an option? If the host and guest share a network, one of them can run a service that makes copying the file possible. – Mr. Donutz Jan 8 at 10:31
  • I think a relevant question (that would give the answer that you need) would be "How do I transfer files from Microsoft's Windows to Gnu/Linux via a network?" – ctrl-alt-delor Jan 8 at 11:41
1

When I need to copy files from/to guest to/from host, I use the python module SimpleHTTPServer.

To copy from guest to host:

  • Activate the host private network (often addresses in 192.168.56.x)
  • From one guest,
    • get the ip: ip a | grep 192.168.56
    • launch a simple http server : python -m SimpleHTTPServer
  • From the host, open firefox and connect to the guest: firefox 192.168.56.xx:8000
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.