A C programming question
I have just done some very basic level C programming and that too a long time ago. I was trying to get a grasp of it again and trying to solve an online free tutorial problem but I cannot get it done. Could any one provide me the complete code for the following problem, I need it for understanding.
A file scrambler - C language
Create a program that generates a child process. Both processes will be given a file to scramble (any file that you choose to give it) from the commandline. The way in which the processes are to scramble the file is to take two consecutive bytes and swap them over in the file – so byte 0 in the file becomes swapped with byte 1 and byte 2 is swapped with byte 3 and so on. One of the processes is to begin swapping from one end of the file and the other process is to begin swapping from the other end. They're to meet in the “middle” of the file somewhere and stop swapping. At this point, the original file contents are completely bytewise reversed (that is “scrambled”). Running the program on the file again, should of course put all the bytes back in their original order (unscrambling the file).
Extensive comments would be nice as well as they will help me understand the code. Please guys, it would be of great help as I am stuck and would really like to know how to solve it
Comments on this post