Click here to Skip to main content
15,902,819 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to save XML as string(use VC++) Pin
led mike17-Jul-06 18:51
led mike17-Jul-06 18:51 
GeneralRe: how to save XML as string(use VC++) Pin
anguslam17-Jul-06 20:33
anguslam17-Jul-06 20:33 
AnswerRe: how to save XML as string(use VC++) Pin
sunit517-Jul-06 19:42
sunit517-Jul-06 19:42 
QuestionQuestion of DLL SendMessage to exe program Pin
7nightlove17-Jul-06 17:00
7nightlove17-Jul-06 17:00 
AnswerRe: Question of DLL SendMessage to exe program Pin
Naveen17-Jul-06 17:22
Naveen17-Jul-06 17:22 
GeneralRe: Question of DLL SendMessage to exe program Pin
7nightlove17-Jul-06 18:40
7nightlove17-Jul-06 18:40 
GeneralRe: Question of DLL SendMessage to exe program Pin
Naveen17-Jul-06 18:52
Naveen17-Jul-06 18:52 
GeneralRe: Question of DLL SendMessage to exe program Pin
7nightlove17-Jul-06 22:33
7nightlove17-Jul-06 22:33 
Questionhow to set the button position??? Pin
mimimimilaw17-Jul-06 16:29
mimimimilaw17-Jul-06 16:29 
AnswerRe: how to set the button position??? Pin
Chris Losinger17-Jul-06 16:41
professionalChris Losinger17-Jul-06 16:41 
AnswerRe: how to set the button position??? Pin
Naveen17-Jul-06 17:26
Naveen17-Jul-06 17:26 
AnswerRe: how to set the button position??? Pin
Hamid_RT17-Jul-06 18:12
Hamid_RT17-Jul-06 18:12 
Questionsever Pin
With_problem17-Jul-06 16:24
With_problem17-Jul-06 16:24 
QuestionHow can we insert a new item to another program's ListCtrl control? Pin
tangbo617-Jul-06 15:58
tangbo617-Jul-06 15:58 
QuestionDebug Assertion Failed(File wingdi.cpp, line : 1054) Pin
dashprasannajit17-Jul-06 15:41
dashprasannajit17-Jul-06 15:41 
QuestionRe: Debug Assertion Failed(File wingdi.cpp, line : 1054) Pin
Nibu babu thomas17-Jul-06 18:54
Nibu babu thomas17-Jul-06 18:54 
QuestionInherited Class as Base Class in ClassWizard? Pin
Reagan Conservative17-Jul-06 11:55
Reagan Conservative17-Jul-06 11:55 
AnswerRe: Inherited Class as Base Class in ClassWizard? Pin
Nibu babu thomas17-Jul-06 18:19
Nibu babu thomas17-Jul-06 18:19 
QuestionRegular expressions Pin
Harold_Wishes17-Jul-06 11:13
Harold_Wishes17-Jul-06 11:13 
AnswerRe: Regular expressions Pin
led mike17-Jul-06 11:24
led mike17-Jul-06 11:24 
Questiondynamic array of strings Pin
jon-8017-Jul-06 10:24
professionaljon-8017-Jul-06 10:24 
Confused | :confused:

I am trying to create a dynamic string array m_pSentences[iLineCount], where iLineCOunt is the number of lines in a text file.

What should the synthax be?

Error:
(35): error C2440: '=' : cannot convert from 'char (*)[1000]' to 'char *'


Code:

char strSentence [MAX_SENTENCES_PER_FILE + 1] [MAX_CHARS_PER_SENTENCE + 1] = {""};
char strFileToRead[MAX_FILEPATH_LENGTH + 1] = {"c:\\temp\\testfile.txt"};

int iLineCount = 0;

// read the file and update temporary array
fstream file_op(strFileToRead, ios::in);
while(!file_op.eof())
{
file_op.getline(strSentence[iLineCount], MAX_CHARS_PER_SENTENCE);

iLineCount++;
}
file_op.close();

// create an array of sentences
char *m_pSentences;
m_pSentences = new char[iLineCount + 1] [MAX_CHARS_PER_SENTENCE];
for (int iIndex = 0; iIndex <= iLineCount; iIndex++)
{
strcpy(strSentence[iIndex], m_pSentences);
//m_pSentences[iIndex] = *strSentence[iIndex];
}

for (int iIndex = 0; iIndex <= iLineCount; iIndex++)
{
cout << m_pSentences[iIndex] << endl;
}

delete [] m_pSentences;
}

Jon
AnswerRe: dynamic array of strings [modified] Pin
Chris Losinger17-Jul-06 10:48
professionalChris Losinger17-Jul-06 10:48 
GeneralRe: dynamic array of strings Pin
led mike17-Jul-06 11:02
led mike17-Jul-06 11:02 
GeneralRe: dynamic array of strings Pin
Chris Losinger17-Jul-06 11:06
professionalChris Losinger17-Jul-06 11:06 
GeneralRe: dynamic array of strings Pin
led mike17-Jul-06 11:19
led mike17-Jul-06 11:19 

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.