Click here to Skip to main content
15,922,315 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to split an array containing an entire file (.exe/.jpg/.avi/.docx etc) into rows of a 2 dimensional matrix (2d array).
This is just to apply some cipher (encryption) operations.
Posted
Updated 14-May-13 18:40pm
v2

1 solution

You have already asked this question at Encrypting a binary file.[^].

However, a file is just a stream of bytes, so you just need to read it into a byte array and then manipulate the contents according to your requirements. The standard CRT library fread function[^], or the Windows ReafFile function[^], will do what you want.
 
Share this answer
 
Comments
compuknow 15-May-13 5:33am    
But does it take the data into a 2 d array. It will only place the data into a linear array.
Richard MacCutchan 15-May-13 7:23am    
No, the I/O functions are designed to read data into a 1d linear array. If you want it in 2d then you have to write the code to do it. That's what being a developer is all about.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900