Hi,
I am getting the error "Segmentation fault" when i run my program. Then when i debug the code to find the cause of the error i get the following error messages. I do not know what these error messages mean:
Error Message:
------------------------------------------------------------------
Program received signal SIGSEGV, Segmentation fault.
0x67656c6c in ?? ()
(gdb) n
Cannot find bounds of current function
--------------------------------------------------------------------
The error messages are generated when i debug at line number 429 in the following function correct_file which is a member function the class circuit. The function is used to modify one line in the file *ftp.
410 int circuit::correct_file(int no1, int no2, char *ftp)
411 {
412 // The following part of the code corrects the line in file
413 deque <string> text_1;
414 std::string s2,t2;
415 /* Counting the number of original lines in the file */
416 ifstream ficnf;
417 int size_f = 0;
418
419 /* Count the number of lines in the file */
420 std::string linef;
421 ficnf.open(ftp,ios::in);
422 if (!ficnf.is_open())
423 {
424 cout<< "Error opening file" << "\n";
425 exit(-1);
426 }
427 else
428 {
429 while(getline(ficnf,linef))
430 {
431 size_f++;
432 }
433
434 ficnf.close();
435 }
The getline statement seems fine to me but the error is coming at this line. Also the error occurs when i call the function "correct_file" the second time and not the first time.
Any help is appreciated.
Thanks