Click here to Skip to main content
15,897,519 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionTutorial Pin
Karthikeyan U25-Jul-06 0:42
Karthikeyan U25-Jul-06 0:42 
GeneralRe: Tutorial Pin
see me25-Jul-06 0:49
see me25-Jul-06 0:49 
GeneralRe: Tutorial Pin
see me25-Jul-06 1:32
see me25-Jul-06 1:32 
AnswerRe: Tutorial Pin
ThatsAlok25-Jul-06 1:12
ThatsAlok25-Jul-06 1:12 
AnswerRe: Tutorial Pin
Cedric Moonen25-Jul-06 1:14
Cedric Moonen25-Jul-06 1:14 
AnswerRe: Tutorial Pin
toxcct25-Jul-06 1:59
toxcct25-Jul-06 1:59 
AnswerRe: Tutorial Pin
Hamid_RT25-Jul-06 2:32
Hamid_RT25-Jul-06 2:32 
Questionfile to array Pin
nmx_de25-Jul-06 0:35
nmx_de25-Jul-06 0:35 
Hello all,

i want to be able to read any file in binary mode and put the files content into a char array, but it just won't work except of text files. How can this be done?

Thanks in advance

<br />
char* Files::ReadFile(const char* file) {<br />
  ifstream::pos_type size;<br />
  char* file_array;<br />
  ifstream file (file, ios::in|ios::binary|ios::ate);<br />
  if (file.is_open())<br />
  {<br />
    size = file.tellg();<br />
    file_array = new char[size];<br />
    file.seekg (0, ios::beg);<br />
    file.read (file_array, size);<br />
    file.close();<br />
<br />
    return file_array;<br />
  }<br />
  return "Unable to open file";<br />
}<br />

AnswerRe: file to array Pin
Cedric Moonen25-Jul-06 1:51
Cedric Moonen25-Jul-06 1:51 
GeneralRe: file to array Pin
nmx_de25-Jul-06 2:22
nmx_de25-Jul-06 2:22 
GeneralRe: file to array Pin
Parthi_Appu25-Jul-06 2:28
Parthi_Appu25-Jul-06 2:28 
GeneralRe: file to array Pin
nmx_de25-Jul-06 2:46
nmx_de25-Jul-06 2:46 
GeneralRe: file to array Pin
Cedric Moonen25-Jul-06 2:57
Cedric Moonen25-Jul-06 2:57 
GeneralRe: file to array Pin
Cedric Moonen25-Jul-06 2:43
Cedric Moonen25-Jul-06 2:43 
GeneralRe: file to array Pin
earl25-Jul-06 4:20
earl25-Jul-06 4:20 
AnswerRe: file to array Pin
Parthi_Appu25-Jul-06 2:25
Parthi_Appu25-Jul-06 2:25 
QuestionIs there a GetRedraw function or message? Pin
Paul Vickery25-Jul-06 0:33
professionalPaul Vickery25-Jul-06 0:33 
AnswerRe: Is there a GetRedraw function or message? Pin
Michael Dunn25-Jul-06 7:16
sitebuilderMichael Dunn25-Jul-06 7:16 
Questionassigningn your application to a protocol [modified] Pin
hell_admin25-Jul-06 0:29
hell_admin25-Jul-06 0:29 
AnswerRe: assigningn your application to a protocol Pin
David Crow25-Jul-06 3:03
David Crow25-Jul-06 3:03 
AnswerRe: assigningn your application to a protocol Pin
hell_admin26-Jul-06 3:02
hell_admin26-Jul-06 3:02 
QuestionWMA To WAV Pin
yhl2ws24-Jul-06 23:53
yhl2ws24-Jul-06 23:53 
AnswerRe: WMA To WAV Pin
toxcct25-Jul-06 0:01
toxcct25-Jul-06 0:01 
GeneralRe: WMA To WAV Pin
ThatsAlok25-Jul-06 0:34
ThatsAlok25-Jul-06 0:34 
GeneralRe: WMA To WAV Pin
Hamid_RT25-Jul-06 2:35
Hamid_RT25-Jul-06 2:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.