Click here to Skip to main content
15,895,799 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionIterating Vector Pin
T.RATHA KRISHNAN1-Jul-10 21:30
T.RATHA KRISHNAN1-Jul-10 21:30 
AnswerRe: Iterating Vector Pin
Cedric Moonen1-Jul-10 21:40
Cedric Moonen1-Jul-10 21:40 
AnswerRe: Iterating Vector Pin
Stephen Hewitt1-Jul-10 21:45
Stephen Hewitt1-Jul-10 21:45 
GeneralRe: Iterating Vector Pin
T.RATHA KRISHNAN1-Jul-10 22:14
T.RATHA KRISHNAN1-Jul-10 22:14 
AnswerRe: Iterating Vector Pin
Aescleal1-Jul-10 22:29
Aescleal1-Jul-10 22:29 
GeneralSolved Pin
T.RATHA KRISHNAN1-Jul-10 23:16
T.RATHA KRISHNAN1-Jul-10 23:16 
QuestionHelp for Printing? Pin
Le@rner1-Jul-10 20:56
Le@rner1-Jul-10 20:56 
Questiongetline throws exception Pin
T.RATHA KRISHNAN1-Jul-10 18:54
T.RATHA KRISHNAN1-Jul-10 18:54 
Hi!
I've got the following exception in my program.

Unhandled exception at 0x005e47c9 in SlogOut3D.exe: 0xC0000005: Access violation writing location 0x006f1b89.

My Code is:

ifstream myfile("E://Work//Data//playerdata.txt.txt", ios_base::in);
  char* line = "";
  ofstream test("E:\Work\Data\test.txt", ios_base::out);
  
  if(!myfile.is_open())
  {
   cout<<"Opening File E://Work//Data//playerdata.txt failed"<<endl;
   cout<<"ERROR Code:"<<"\t"<<GetLastError()<<endl;
  }
  if(!test.is_open())
  {
   cout<<"Opening File E://Work//Data//test.txt failed"<<endl;
   cout<<"ERROR Code:"<<"\t"<<GetLastError()<<endl;
  }
  if(myfile)
  {
   myfile.getline(line, 1);
   cout<<line<<endl;
   test.write(line, 1);
  }


Call Stack:

> SlogOut3D.exe!std::basic_istream<char,std::char_traits<char> >::getline(char * _Str=0x006f1b89, int _Count=0, char _Delim='
') Line 638 + 0x3 bytes C++
SlogOut3D.exe!std::basic_istream<char,std::char_traits<char> >::getline(char * _Str=0x006f1b89, int _Count=1) Line 596 C++
SlogOut3D.exe!CGameMenuPlayerProfileState::GUIEvent(CGameManager * pManager=0x0012fdb4, const irr::SEvent & event={...}) Line 143 C++
SlogOut3D.exe!CGameManager::OnEvent(const irr::SEvent & event={...}) Line 171 + 0x1d bytes C++
Irrlicht.dll!1000dccf()
[Frames below may be incorrect and/or missing, no symbols loaded for Irrlicht.dll]
Irrlicht.dll!10002d28()
Irrlicht.dll!1000e1b6()
Irrlicht.dll!101325ae()
Irrlicht.dll!101333b3()
shimeng.dll!6c9c4435()
gdi32.dll!763948d9()
user32.dll!760c0979()
opengl32.dll!6d50834f()
user32.dll!760bfd72()
user32.dll!760bfe4a()
user32.dll!760bfdf3()
user32.dll!760c018d()
user32.dll!760b8343()
Irrlicht.dll!10134005()
SlogOut3D.exe!main() Line 24 + 0x25 bytes C++
SlogOut3D.exe!_QueryPerformanceFrequency@4() + 0x347f bytes C++
SlogOut3D.exe!004f7f26()
kernel32.dll!7600d0e9()
ntdll.dll!773b19bb()
ntdll.dll!773b198e()
SlogOut3D.exe!applyAnisotropicFriction() + 0x4f bytes
Irrlicht.dll!10044800()

How to resolve this exception?
AnswerRe: getline throws exception PinPopular
Stephen Hewitt1-Jul-10 18:58
Stephen Hewitt1-Jul-10 18:58 
GeneralRe: getline throws exception Pin
T.RATHA KRISHNAN1-Jul-10 19:08
T.RATHA KRISHNAN1-Jul-10 19:08 
GeneralRe: getline throws exception Pin
Stephen Hewitt1-Jul-10 19:14
Stephen Hewitt1-Jul-10 19:14 
GeneralRe: getline throws exception Pin
T.RATHA KRISHNAN1-Jul-10 19:35
T.RATHA KRISHNAN1-Jul-10 19:35 
QuestionProblem with '&' character to dispaly in Static Text control. Pin
Le@rner1-Jul-10 18:16
Le@rner1-Jul-10 18:16 
AnswerRe: Problem with '&' character to dispaly in Static Text control. Pin
«_Superman_»1-Jul-10 18:22
professional«_Superman_»1-Jul-10 18:22 
AnswerRe: Problem with '&' character to dispaly in Static Text control. Pin
Stephen Hewitt1-Jul-10 18:23
Stephen Hewitt1-Jul-10 18:23 
GeneralRe: Problem with '&' character to dispaly in Static Text control. Pin
Le@rner1-Jul-10 18:27
Le@rner1-Jul-10 18:27 
GeneralRe: Problem with '&' character to dispaly in Static Text control. Pin
Stephen Hewitt1-Jul-10 18:39
Stephen Hewitt1-Jul-10 18:39 
GeneralRe: Problem with '&' character to dispaly in Static Text control. Pin
Le@rner1-Jul-10 18:58
Le@rner1-Jul-10 18:58 
GeneralRe: Problem with '&' character to dispaly in Static Text control. Pin
Stephen Hewitt1-Jul-10 19:05
Stephen Hewitt1-Jul-10 19:05 
GeneralRe: Problem with '&' character to dispaly in Static Text control. Pin
Le@rner1-Jul-10 20:11
Le@rner1-Jul-10 20:11 
GeneralRe: Problem with '&' character to dispaly in Static Text control. Pin
«_Superman_»1-Jul-10 19:21
professional«_Superman_»1-Jul-10 19:21 
Questionabout SetThreadContext Pin
rockago1-Jul-10 10:06
rockago1-Jul-10 10:06 
QuestionPrevent context switch Pin
Shay Harel1-Jul-10 8:37
Shay Harel1-Jul-10 8:37 
AnswerRe: Prevent context switch Pin
Cedric Moonen1-Jul-10 8:40
Cedric Moonen1-Jul-10 8:40 
GeneralRe: Prevent context switch Pin
Shay Harel1-Jul-10 9:00
Shay Harel1-Jul-10 9:00 

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.