| | |
repost: leak using c++ string
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2005
Posts: 2
Reputation:
Solved Threads: 0
Hi
part of a homework .
I got a lek in this code when using string for parsing
I do not 'have' to use string.. it just seemed comfortable
input is of the form 2*x**6+term+term+...
[ full source code availabe if that helps ]
part of a homework .
I got a lek in this code when using string for parsing
I do not 'have' to use string.. it just seemed comfortable
input is of the form 2*x**6+term+term+...
[ full source code availabe if that helps ]
C++ Syntax (Toggle Plain Text)
#include <string> //possibly causes memleak - try switching to c string Polynomial::Polynomial(char* poly):_head(NULL){ string s = poly; s = "+" + s; double cof; int exp; int chars; unsigned int index = 0; while (index != string::npos){ s = s.substr(index+1); chars = sscanf(s.c_str(),"%lf *x** %d",&cof,&exp); if (chars == 2){ insert(cof,exp); } else { cout<<"Wrong Format!"; break; } index = s.find_first_of("+",index); } }
![]() |
Similar Threads
- Pascal- lotto generation program (Pascal and Delphi)
- HELP Plz:Memory Leak in std::string (C++)
- memory leak on passing string parameters to constructors? (C++)
- continuous string (C)
- leak using c++ string (C++)
Other Threads in the C++ Forum
- Previous Thread: Change Counter
- Next Thread: Help
Views: 1860 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





