Click here to Skip to main content
15,889,096 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: dynamic array of strings Pin
jon-8018-Jul-06 10:52
professionaljon-8018-Jul-06 10:52 
GeneralRe: dynamic array of strings Pin
Chris Losinger18-Jul-06 11:33
professionalChris Losinger18-Jul-06 11:33 
QuestionRe: dynamic array of strings Pin
jon-8019-Jul-06 5:39
professionaljon-8019-Jul-06 5:39 
AnswerRe: dynamic array of strings Pin
Chris Losinger19-Jul-06 5:46
professionalChris Losinger19-Jul-06 5:46 
QuestionRe: dynamic array of strings Pin
jon-8019-Jul-06 6:05
professionaljon-8019-Jul-06 6:05 
AnswerRe: dynamic array of strings Pin
Chris Losinger19-Jul-06 6:57
professionalChris Losinger19-Jul-06 6:57 
AnswerRe: dynamic array of strings Pin
Hamid_RT17-Jul-06 19:40
Hamid_RT17-Jul-06 19:40 
QuestionTreeview creation problem Pin
Alex Cutovoi17-Jul-06 8:57
Alex Cutovoi17-Jul-06 8:57 
AnswerRe: Treeview creation problem Pin
led mike17-Jul-06 10:49
led mike17-Jul-06 10:49 
AnswerRe: Treeview creation problem Pin
valikac17-Jul-06 10:56
valikac17-Jul-06 10:56 
GeneralRe: Treeview creation problem Pin
led mike17-Jul-06 11:01
led mike17-Jul-06 11:01 
QuestionClose Dialog Pin
Manjunath S17-Jul-06 8:14
Manjunath S17-Jul-06 8:14 
AnswerRe: Close Dialog Pin
valikac17-Jul-06 8:35
valikac17-Jul-06 8: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.