error: acces violation
| poema (1) | ||||
| Guys, I've a little problem with a little program and I can't figure out what the problem is and how to solve it. Purpose of the program: open a .csv file read a line split the string (delimiter = ; ) and store the substrings. Sounds easy, however: it won't run, it doesn't give errors and while debugging it says:
Who can help me? It's a subfunction of a bigger project with a deadline way too soon! Thank you very much, poema.
ps: the .csv file is filled with this kind of strings: "1;18/03/2008 11:55;20;-95;498" | ||||
| guestgulkan (150) | |||
| Line 14 and 19 are the problem(s). in line 14 -
19 you try copying to it !!!! hence the access violation. you don't need the strcpy function in line 19 because line.c_str returns a char*. So change line 19 to
copy= (char*)line.c_str(); .You may need the cast because line.c_str returns a
const pointer .I used a 'C' style cast, but the c++ way
copy= const_cast <char*>line.c_str(); maybe the more official way to do it. | |||
This topic is archived - New replies not allowed.
