| | |
Why atof causes a C0000005 exeption?
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2007
Posts: 47
Reputation:
Solved Threads: 1
vijayan121 thank you for the links.
Salem,my program looked like this after the edits:
it compiled end builded with no problems,but when executing the program ignores the line: and the initial value of num doesn't change(remains 310.589).
Salem,my program looked like this after the edits:
C++ Syntax (Toggle Plain Text)
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<sstream> #include<iostream> using namespace std; void main () { double num; num=310.589; char buffer [15]; sprintf(buffer,"%f",num); printf("\nbuffer=\n"); printf(buffer); printf("\npartial buffer=\n"); printf((char *)&buffer[3]); printf("\nEnter a number:\n"); //cin>>buffer; scanf("%s",buffer); //num=atof(buffer); stringstream(buffer)>>num; printf("\n%f",num); _getch(); }
it compiled end builded with no problems,but when executing the program ignores the line:
C++ Syntax (Toggle Plain Text)
stringstream(buffer)>>num;
> printf(buffer);
Never use a string you're not in complete control of as the format string for printf.
If anyone ever got a % character into that, your code would be seriously broken.
http://en.wikipedia.org/wiki/Format_string_attack
It's best to always use string constants for printf/scanf formats.
Never use a string you're not in complete control of as the format string for printf.
If anyone ever got a % character into that, your code would be seriously broken.
http://en.wikipedia.org/wiki/Format_string_attack
It's best to always use string constants for printf/scanf formats.
•
•
Join Date: Jul 2007
Posts: 47
Reputation:
Solved Threads: 1
Salem,thank you for the link,I will take this information in mind from now on.
vijayan121, I use VC++ 6.0,
I tried the edits you suggested,it started to give the error message again(actualy even when I removed only the: ,the compiler gave an error message,weird isn't it).
vijayan121, I use VC++ 6.0,
I tried the edits you suggested,it started to give the error message again(actualy even when I removed only the:
C++ Syntax (Toggle Plain Text)
_getch()
Another case of people reading advice but not really acting on it.
The very first thing you need to do is get rid of vc++ 6.0 and either get VC 2005 express or something like dev-cpp.
And then you can ignore all these little conclusions you are drawing, which quite frankly is going to be nonsense because of the tool you're using.
The very first thing you need to do is get rid of vc++ 6.0 and either get VC 2005 express or something like dev-cpp.
And then you can ignore all these little conclusions you are drawing, which quite frankly is going to be nonsense because of the tool you're using.
Last edited by iamthwee; Aug 27th, 2007 at 9:38 am.
•
•
Join Date: Jul 2007
Posts: 47
Reputation:
Solved Threads: 1
I thought maybe it will help if I quote the entire error message:
so, the "Exception code:" is ofcourse the number of the exception.
"Exception address" is the address in memory where the exception occured(please correct me if I'm wrong).
Eax,Ebx,Ecx,Edx- are the registers if I understand correctly(what their
contents means in this case I don't know).
Besides those stuff, I don't understand anything from the above error information,so I don't realy see the entire picture of the error.
Maybe someone can point me the right direction in analyzing this information?
•
•
•
•
LINK : error : Internal error during ReadSymbolTable
ExceptionCode = C0000005
ExceptionFlags = 00000000
ExceptionAddress = 00465817
NumberParameters = 00000002
ExceptionInformation[ 0] = 00000000
ExceptionInformation[ 1] = 00F91184
CONTEXT:
Eax = 00F91180 Esp = 0012F61C
Ebx = 00000000 Ebp = 004A2678
Ecx = 00F91180 Esi = 00F60E94
Edx = 00000001 Edi = 004A2928
Eip = 00465817 EFlags = 00010212
SegCs = 0000001B SegDs = 00000023
SegSs = 00000023 SegEs = 00000023
SegFs = 0000003B SegGs = 00000000
Dr0 = 0012F61C Dr3 = 00000000
Dr1 = 004A2678 Dr6 = 00F91180
Dr2 = 00000000 Dr7 = 00000000
Error executing link.exe.
Tool execution canceled by user.
"Exception address" is the address in memory where the exception occured(please correct me if I'm wrong).
Eax,Ebx,Ecx,Edx- are the registers if I understand correctly(what their
contents means in this case I don't know).
Besides those stuff, I don't understand anything from the above error information,so I don't realy see the entire picture of the error.
Maybe someone can point me the right direction in analyzing this information?
Last edited by Arctic wolf; Aug 27th, 2007 at 9:57 am.
>Maybe someone can point me the right direction in analyzing this information?
Step one, please re-read the following...
http://www.daniweb.com/forums/post425170-15.html
Step one, please re-read the following...
http://www.daniweb.com/forums/post425170-15.html
•
•
Join Date: Jul 2007
Posts: 47
Reputation:
Solved Threads: 1
•
•
•
•
Really, have you installed the windows sdk which you have to download separately for vc 2005 express?
Or have you tried dev-cpp which already has support for resource files and is less than a 10MB download?
But I still would like to learn to analyze the error data I mentioned above.
![]() |
Similar Threads
- atof ??? how can I change from user? (C)
- URGENT!! atof, strtof, strod ...drivin me nuts!! (C)
- Fatal Error, c0000005 Memory could not be read??? (Windows NT / 2000 / XP)
- compilers in C (C++)
- HJT Log - XP SP2, IE6 Problems (Viruses, Spyware and other Nasties)
- The Calculator (C++)
- win2k pro taskmanager won't run (Windows NT / 2000 / XP)
- Creating and destroying objects (C++)
Other Threads in the C++ Forum
- Previous Thread: creating dynamic array
- Next Thread: about main()
| Thread Tools | Search this Thread |
api array arrays based binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






