Click here to Skip to main content
16,005,316 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Complex Equations... Pin
markkuk10-Feb-03 2:03
markkuk10-Feb-03 2:03 
GeneralRe: Complex Equations... Pin
EnigmaticalShadow10-Feb-03 6:45
sussEnigmaticalShadow10-Feb-03 6:45 
GeneralRe: Complex Equations... Pin
EnigmaticalShadow10-Feb-03 7:16
sussEnigmaticalShadow10-Feb-03 7:16 
GeneralDialog Box Question Pin
Paddy9-Feb-03 8:58
Paddy9-Feb-03 8:58 
GeneralRe: Dialog Box Question Pin
Nish Nishant9-Feb-03 9:05
sitebuilderNish Nishant9-Feb-03 9:05 
GeneralRe: Dialog Box Question Pin
Paddy9-Feb-03 9:55
Paddy9-Feb-03 9:55 
GeneralRe: Dialog Box Question Pin
Nish Nishant9-Feb-03 12:21
sitebuilderNish Nishant9-Feb-03 12:21 
Generalcrash with push_back for vector Pin
nss9-Feb-03 7:58
nss9-Feb-03 7:58 
What am I doing wrong? I want to read the names from a file and put them onto a vector of char*......it crashes at the pushback. Each file name is on a different line.

I did a dir/b in dos and got a txt file with a list of file names (a bunch of .bmps) from the directory. I assume theres carriage returns at the end of each line. But maybe not. There are 18 letters in the name08FEB096_9571s.bmp, and carriage return line feed is 1 byte (MSDN).

CFile file;

std::vector<char*> fileVec;

file.Open("c:\\miss\\SImages.txt", CFile::modeRead, 0);

char* pBuf;

char folder[200];

strcpy(folder , "C:\\miss\\");

for (int i = 0; i <96; i++)
{

    pBuf = new char[200];

    file.Read( pBuf,20);

    strcat(folder, pBuf);

    fileVec.push_back(folder);

    delete[] pBuf;
}


file.Close();

GeneralRe: crash with push_back for vector Pin
Chris Losinger9-Feb-03 8:50
professionalChris Losinger9-Feb-03 8:50 
GeneralRe: crash with push_back for vector Pin
nss9-Feb-03 13:11
nss9-Feb-03 13:11 
GeneralRe: crash with push_back for vector Pin
Solomon Wu9-Feb-03 18:17
Solomon Wu9-Feb-03 18:17 
GeneralRe: crash with push_back for vector Pin
Jambolo9-Feb-03 21:55
Jambolo9-Feb-03 21:55 
Generalthanks everyone!!! Pin
ns10-Feb-03 1:15
ns10-Feb-03 1:15 
Generalreading a string from a file with CFile Read() Pin
nss9-Feb-03 6:40
nss9-Feb-03 6:40 
GeneralRe: reading a string from a file with CFile Read() Pin
Chris Losinger9-Feb-03 7:12
professionalChris Losinger9-Feb-03 7:12 
GeneralThank you!!!!! Pin
nss9-Feb-03 8:19
nss9-Feb-03 8:19 
GeneralCalling functions in DLL Pin
hongheo769-Feb-03 5:24
hongheo769-Feb-03 5:24 
GeneralRe: Calling functions in DLL Pin
Roman Nurik9-Feb-03 5:29
Roman Nurik9-Feb-03 5:29 
GeneralSIMPLE db example Pin
JockeP9-Feb-03 4:58
JockeP9-Feb-03 4:58 
GeneralRe: SIMPLE db example Pin
l a u r e n9-Feb-03 7:15
l a u r e n9-Feb-03 7:15 
GeneralRe: SIMPLE db example Pin
Anonymous9-Feb-03 7:17
Anonymous9-Feb-03 7:17 
GeneralRe: SIMPLE db example Pin
l a u r e n9-Feb-03 7:21
l a u r e n9-Feb-03 7:21 
GeneralRe: SIMPLE db example Pin
JockeP9-Feb-03 10:59
JockeP9-Feb-03 10:59 
GeneralRe: SIMPLE db example Pin
Michael P Butler9-Feb-03 11:21
Michael P Butler9-Feb-03 11:21 
GeneralRe: SIMPLE db example Pin
bryce9-Feb-03 15:30
bryce9-Feb-03 15:30 

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.