Click here to Skip to main content
15,920,031 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: read document file Pin
Rajesh R Subramanian28-Jan-08 1:15
professionalRajesh R Subramanian28-Jan-08 1:15 
QuestionRegarding Your suggestion:: Pin
rowdy_vc++27-Jan-08 23:41
rowdy_vc++27-Jan-08 23:41 
QuestionRe: Regarding Your suggestion:: Pin
CPallini27-Jan-08 23:51
mveCPallini27-Jan-08 23:51 
GeneralRe: Regarding Your suggestion:: Pin
rowdy_vc++28-Jan-08 0:01
rowdy_vc++28-Jan-08 0:01 
QuestionRe: Regarding Your suggestion:: Pin
CPallini28-Jan-08 0:10
mveCPallini28-Jan-08 0:10 
GeneralRe: Regarding Your suggestion:: Pin
rowdy_vc++28-Jan-08 0:14
rowdy_vc++28-Jan-08 0:14 
GeneralRe: Regarding Your suggestion:: Pin
CPallini28-Jan-08 0:36
mveCPallini28-Jan-08 0:36 
GeneralRe: Regarding Your suggestion:: Pin
Iain Clarke, Warrior Programmer28-Jan-08 0:23
Iain Clarke, Warrior Programmer28-Jan-08 0:23 
You can't be serious. Before posting here, trying reading the documentation for the objects you are using.

get_array is a CStringArray, which (as the name hints) is an array of strings.
file represents a... file. GetLength does what is says - it gets the length of the file.

You've just written...

"An array of strings" = 973.


You could always try and compile your code to find out if your syntax is correct. Mr Pallini's time is more precious than your computers.



What CPallini told you is to read the file one line at a time, and add it to the CStringArray.

If you look at CStringArray, it has a member function called Add, which takes a string or TCHAR *. You need to use that inside some sort of loop.


Also, if you look at CStdioFile instead of CFile, it has a friendly method called ReadString, which makes reading from a text file much simpler than reading from a CFile.


Hopefully you should be able to put something together now.


Good luck!

Iain.
GeneralOut of Memory Pin
Andre Rios27-Jan-08 23:33
Andre Rios27-Jan-08 23:33 
GeneralRe: Out of Memory Pin
Iain Clarke, Warrior Programmer27-Jan-08 23:39
Iain Clarke, Warrior Programmer27-Jan-08 23:39 
GeneralRe: Out of Memory Pin
Andre Rios29-Jan-08 22:31
Andre Rios29-Jan-08 22:31 
GeneralRead buffer into a string. Pin
CodingLover27-Jan-08 23:00
CodingLover27-Jan-08 23:00 
GeneralRe: Read buffer into a string. Pin
Cedric Moonen27-Jan-08 23:08
Cedric Moonen27-Jan-08 23:08 
GeneralRe: Read buffer into a string. Pin
CodingLover27-Jan-08 23:14
CodingLover27-Jan-08 23:14 
GeneralRe: Read buffer into a string. Pin
Cedric Moonen27-Jan-08 23:21
Cedric Moonen27-Jan-08 23:21 
GeneralRe: Read buffer into a string. Pin
Maxwell Chen27-Jan-08 23:09
Maxwell Chen27-Jan-08 23:09 
GeneralRe: Read buffer into a string. Pin
CodingLover27-Jan-08 23:18
CodingLover27-Jan-08 23:18 
GeneralRe: Read buffer into a string. Pin
Maxwell Chen27-Jan-08 23:21
Maxwell Chen27-Jan-08 23:21 
GeneralRe: Read buffer into a string. Pin
CodingLover27-Jan-08 23:35
CodingLover27-Jan-08 23:35 
QuestionRe: Read buffer into a string. Pin
CPallini27-Jan-08 23:17
mveCPallini27-Jan-08 23:17 
GeneralRe: Read buffer into a string. Pin
CodingLover27-Jan-08 23:22
CodingLover27-Jan-08 23:22 
GeneralRe: Read buffer into a string. Pin
CPallini27-Jan-08 23:38
mveCPallini27-Jan-08 23:38 
GeneralRe: Read buffer into a string. Pin
CodingLover27-Jan-08 23:52
CodingLover27-Jan-08 23:52 
GeneralRe: Read buffer into a string. Pin
CPallini28-Jan-08 0:17
mveCPallini28-Jan-08 0:17 
GeneralRe: Read buffer into a string. Pin
CodingLover28-Jan-08 0:20
CodingLover28-Jan-08 0:20 

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.