well the error i get is the title above:
error C2664: 'searchTree' : cannot convert parameter 2 from 'const char *' to 'char'
error is form this line -
searchTree(treeObj->root ,data1.c_str());
-
i have also attached searchTree below for yr reference -
Tree<char> *treeObj = NULL;
-
TreeNode<char> *treeNodeObj = NULL;
-
-
TreeNode<char>* searchTree(TreeNode<char> *cur, char nodeToAdd)
-
{
-
if(cur == NULL)
-
{
-
return NULL;
-
}
-
if(cur->IsSameNode(nodeToAdd))
-
{
-
return cur;
-
}
-
searchTree(cur->getLeft(), nodeToAdd);
-
searchTree(cur->getRight(), nodeToAdd);
-
}
-
could anyone help me with this problem..?
well at first i get the problem that it can convert from char to string.. thats y i added the .c_str() but now it gives me the new error above..
any help is appreciated..
I will check forum every 5 mins .. so i will reply quick..
Thanks in advance :)
5 5392
what is 'data1' ? How did you declare it?
other than that, it LOOKS like you are attempting to make 'data1' into a string, and then pass it into a function looking for a char ... that's just not gonna happen ... why are you passing some sort of string into a char argument?
oops my bad..
i declared it as string.. -
void handleOneLine(string string1)
-
{
-
char * cstr, *p;
-
int counter;
-
string str (string1);
-
string data1, data2, data3;
-
-
cstr = new char [str.size()+1];
-
strcpy (cstr, str.c_str());
-
-
// cstr now contains a c-string copy of str
-
-
int count = 0;
-
p=strtok (cstr,",");
-
count++;
-
while (p!=NULL)
-
{
-
p=strtok(NULL,",");
-
if( count == 1 )
-
{
-
data1.append(p);
-
searchTree(treeObj->root ,data1.c_str());
-
}
-
else if( count == 2 )
-
{
-
data2.append(p);
-
// treeNodeObj->setLeft(data2);
-
}
-
else if( count == 3 )
-
{
-
data3.append(p);
-
// treeNodeObj->setRight(data3);
-
}
-
count++;
-
if( count == 3 )
-
break;
-
}
-
-
delete[] cstr;
-
}
-
I edited my previous post, not sure if you saw ...
it looks like you are attempting to make 'data1' into a string, and then pass it into a function looking for a char ... that's just not gonna happen ... why are you passing some sort of string into a char argument?
I edited my previous post, not sure if you saw ...
it looks like you are attempting to make 'data1' into a string, and then pass it into a function looking for a char ... that's just not gonna happen ... why are you passing some sort of string into a char argument?
oh yea.. haha i must be looking like a fool now...
err... so just use char variables from the start then yea?
done that.. that problem is solved.
thanks for yr help :)
it happens, everybody does that kind of stuff
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Ajay |
last post by:
hi!
I have a c++ file that does some XML processing (visual c++ using ATL). The
file builds fine. However when i add the header #include<Python.h>, i get a
number of errors
C:\Windows CE Tools\wce300\Pocket PC 2002\atl\include\atlbase.h(5395) :
error C2664: '__WinCE_OutputDebugStringA' : cannot convert parameter 1
from 'const unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires
reinterpret_cast,...
|
by: mkarja |
last post by:
Hi,
I've been struggling with this error for a while and I don't
know what's wrong. Any help would be appreciated.
Here's code snippets and the error message.
----------------------------
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
LPARAM lParam, LPARAM lParamClient, HWND _hClient);
----------------------------
|
by: Karthik |
last post by:
Hello
I am trying to convert the following???
The Code
std::string* ChkName;
|
by: Scott Chang |
last post by:
Hi all
I copied the following VC++ 6.0 code (written by someone in the website) to my VC++ .Net 2002-Windows XP Pro PC
////****Solution 'dyndllclass' (2 projects)***///
///***dynapp****(1st project)***//
//----dynapp.cpp----/
#include <windows.h
#include "dynclass.h
int main ( void
|
by: GRoll35 |
last post by:
I get 4 of those errors. in the same spot. I'll show my parent class,
child class, and my driver.
All that is suppose to happen is the user enters data and it uses
parent/child class to display it.
here is the 4 errors.
c:\C++\Ch15\Employee.h(29): error C2440: '=' : cannot convert from
'char ' to 'char '
| |
by: kaizen |
last post by:
Hi,
i wrote the code in C and compiled in VC++ compiler. at that time it
has thrown the below mentioned error.
error C2664: 'strcpy' : cannot convert parameter 2 from 'char' to
'const char *'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
|
by: Nick |
last post by:
I'm learning C++ and ran into a compile error using Visual C++ 2005
Express on the following example program (located at
http://www.cplusplus.com/doc/tutorial/templates.html):
// template specialization
#include <iostream>
using namespace std;
template <class T>
class container {
|
by: i |
last post by:
#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<string.h>
char ch;
int n,m;
void main();
char check(int,int,char);
void cash(int,int,char);
void debit_card(int,int,char);
|
by: misu101 |
last post by:
Hi,
I have a VS 6 project and I am trying to compile it using VS 2005.
My program has the atlbase.h include which seems to trigger the errors.
It used to compile OK using VS 6.
The include path is:
C:/Program Files/Microsoft Visual Studio 8/VC/include;C:/Program Files/Microsoft Visual Studio 8/VC/atlmfc/include;C:/Program Files/Microsof
t Visual Studio 8/SDK/v2.0/include;C:/Program Files/Microsoft Visual Studio...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |