Let's say I want to read a binary file which contains three of data types char, int and double (However,this binary file can contain any number of these three data types in any order.). And then I want to store three of these data types to char array list, double array list and integer array list. Anyone could be able to help? I really appreciate it.
-
What for do you need this?Andrew Logvinov– Andrew Logvinov2013-04-27 21:39:55 +00:00Commented Apr 27, 2013 at 21:39
-
@AndrewLogvinov What difference does it make? There are plenty of binary file formats out there, and they all need reading.user207421– user2074212013-04-27 22:18:30 +00:00Commented Apr 27, 2013 at 22:18
Add a comment
|
2 Answers
Your file needs some kind of map on how to read it. There is no magic function that can distinguish between lets say 4 char and 1 int.
You need to open the file, read the map then read the file accordingly
3 Comments
14K
What exactly do you mean by map?
Eric
You need a place in your file that says "3 chars in a row, then 2 ints in a row, then a double, then 2 more chars" and so on
An SO User
@SHAWNNN Use
Channels :D