473,403 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

C++ string pointer params

Hi, I am a newbie in C++.

I got an error that I could not shake off. I know it should be a simple one to solve but it just eludes me.

My code fragment is like this :

int main()
{
const TCHAR * pszFile;
pszFile = "C:\\test\\temp\\config\\fcst_conf_00d12ddf.da t";
int ret = loadConfigFile ( pszFile );
return 0;
}

int loadConfigFile ( const TCHAR * pszFile )
{

----------------------

the error occur on this line "int ret = loadConfigFile ( pszFile );"

error C2664: 'loadConfigFile' : cannot convert parameter 1 from 'char *' to 'const unsigned short *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast


---

How do I solve this?

Thanks.
Mar 25 '07 #1
2 1616
horace1
1,510 Expert 1GB
do you have a prototype declared somewhere (e.g. in a header file) for loadConfigFile() which is different from
Expand|Select|Wrap|Line Numbers
  1. int loadConfigFile ( const TCHAR * pszFile )
  2.  
e.g. something like
Expand|Select|Wrap|Line Numbers
  1. int loadConfigFile ( const unsigned short * pszFile )
  2.  
this is easy to do if you are using overloaded C++ functions
Mar 25 '07 #2
oh, wow. it seems i forgot to change the declaration since i was so desperate to try anything...

it's just right in front of me and i couln't see it

thanks a lot..


do you have a prototype declared somewhere (e.g. in a header file) for loadConfigFile() which is different from
Expand|Select|Wrap|Line Numbers
  1. int loadConfigFile ( const TCHAR * pszFile )
  2.  
e.g. something like
Expand|Select|Wrap|Line Numbers
  1. int loadConfigFile ( const unsigned short * pszFile )
  2.  
this is easy to do if you are using overloaded C++ functions
Mar 25 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Alastair G. Hogge | last post by:
Hello *, I'm using Python and the cgi module to retrive data from a HTML form. I'm then trying to get that information into a string. But efforts fail when I run type(foo) on my string. type()...
5
by: johkar | last post by:
This script works fine if all form fields have one value, but what do you do if one of the form fields was a multiple select? Example: status=blue&status=red function getParams() { var...
1
by: Chris Mantoulidis | last post by:
PROBLEM: I'm having some weird problems with string::find() (in ParamGenerate()), but since I'm not sure if that is the source of all bad output in my program, I'm posting least code that's...
3
by: Chris Mantoulidis | last post by:
I posted this here one day ago but it seems like it hasn't been put up for some unknown reason. That gives me a chance to say things a bit better in this post. 1st of all let's desribe the...
4
by: Dawn Minnis | last post by:
Hi When I compile my files I get the following: driver.c: In function `main': driver.c:49: warning: assignment makes integer from pointer without a cast driver.c:50: warning: assignment...
4
by: simon | last post by:
hi, I would like to separate my javascript completely from my xhtml. in the end there should be only <script type="text/javascript" src="javalib.js"></script> in the head-tag to my javascript....
10
by: John Vottero | last post by:
Why does String.Format have overrides of: Format(string, object) Format(string, object, object) Format(string, object, object, object) Format(string, params object) doesn't the last one...
3
by: =?Utf-8?B?SmFuIEhlcHBlbg==?= | last post by:
Hi, I've a question. I'm developing a windows application and for the application i need to run functions and procedures that are stored in a database. Here is an example that i tried to get...
3
by: qilin | last post by:
I am trying to save a big text string into MySQL, but I guess i need escape the string firstly, anybody knows any escape function in c for that? or any other suggests ?
6
by: (2b|!2b)==? | last post by:
I am expecting a string of this format: "id1:param1,param2;id2:param1,param2,param3;id" The tokens are seperated by semicolon ";" However each token is really a struct of the following...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.