ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
is there a function in C that would allow you to read data from a stream to another stream. Or do you have to put the data in some kind of container like a struct or a array ?
Hmmm well i know how to read text data from one stream put it into something and then write it back to another one. What im lookiing at is if there is a way to move binary data from one file like an .exe to another .exe file. Now this will probably lead somone to saying we wont tell you how to make a viurs or something to that affect. Im just curious if its even possible in C to move data from one binary file to the begining or end of another binary file. Or is this something that can only be done in assembly ?
Yes, definitely. Just open the file using fopen() in binary mode, if you're on Windows. (In Unix, it doesn't matter.) Then just use fgetc() and fputc(). C char types are bytes, so it works just as you would expect it, for copying binary data.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.