![]() |
| ||
| how to read a binary file data to a monitor Please compare the two codes below why is the first one displaying output to monitor where as the second code is displaying some unwanted characters. CODE 1 ..... |
| ||
| Re: how to read a binary file data to a monitor CODE 1 may end in problems, too, because of the missing terminating 0 in read_array CODE 2 is missing a rewind to begin of file before File.read(memblock,size); and has the same problem with the terminating 0. Replace memblock = new char[size]; by memblock = new char[size + 1]; memblock[size] = 0; |
| ||
| Re: how to read a binary file data to a monitor You would also need to delete the memory you've freed, or else you'll get a memory leak |
| ||
| Re: how to read a binary file data to a monitor Both suffer from having void main as well. |
| All times are GMT -4. The time now is 5:39 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC