473,408 Members | 1,741 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,408 software developers and data experts.

What tpes to use for char array?

This is from something I wrote 15 years ago.

Haven't use c since then

Wanted to use it now so I cut and pasted into VS2005 on WinXP

Now I can't seem to get the types OK

GetModuleFileName requires LPWCH for szModulePath

What are the compatible types??

Thanks

char szModulePath[SIZE_OF_PATH];

GetModuleFileName(happThisInstance, szModulePath, sizeof(szModulePath));
//Remove the FileName from the full pathname

PSTR pstr = szModulePath + lstrlen(szModulePath) - 1;

//note: '\\' is the character \ The first \ is a c language escape character

while ((*pstr != '\\') && (*pstr != ':') && (pstr >= szModulePath)) pstr--;

pstr++;

*pstr=(char)0;
Feb 17 '06 #1
2 3553
>GetModuleFileName requires LPWCH for szModulePath

What are the compatible types??


You could use TCHAR - which is a wide (16-bit) character in a Unicode
build, or a char in a non-Unicode build.

Your existing code should work relatively easily if you change the
(default) setting of your new VS2005 project from Unicode.

Dave
Feb 17 '06 #2
> This is from something I wrote 15 years ago.

Haven't use c since then

Wanted to use it now so I cut and pasted into VS2005 on WinXP

Now I can't seem to get the types OK

GetModuleFileName requires LPWCH for szModulePath

What are the compatible types??


VS2005 has the unicode character set as its default, which is not compatible
with your usage of CHAR*
To solve your problem you have to revert the character set to ASCII.
you do that by setting the 'character set' property in your general project
properties to 'not set'.

Note: if you use precompiled headers, you have to make sure that it is
recompiled after your change, otherwise the compiler will still see the
unicode definition of GetModuleFileName.

--

Kind regards,
Bruno.
br**********************@hotmail.com
Remove only "_nos_pam"
Feb 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: cppaddict | last post by:
I thought that: char x; made x into a pointer-to-char. But how come the following code won't compile: int main() { char pbuf;
3
by: FroxX | last post by:
Hi all, i have a question. What does those ** mean??? For example: void function(Something **pSomething); I hope someone can help me about it. Thanks,
18
by: Matt | last post by:
Hi, I have a probelm here: If I declare: char *p="Hello";
15
by: damian birchler | last post by:
Hi I'm wondering of what type a structure is. Of course, it is a _structure_, but an array isn't an _array_ either. So of what type is a structure? I'd say a pointer, am I right?
13
by: chellappa | last post by:
hi , please explain me , char pointer , char Array, char ,string... i have some many confussion about this... please clarify to me.. i need some example about this program by chellappa.ns
5
by: sherifffruitfly | last post by:
Hi, I'm just learning cpp, and the exercise I'm working on is basically as follows: 1) Create a struct type with 4 members (char, char, char, int). 2) Create an array of, say 3 instances of...
5
by: Omats.Z | last post by:
what is meaning os "char **option meet"? I get a function like this: __________________________________ int getchoice(char *greet, char *choices) { int chosen = 0; int selected; char **option;...
4
by: Bobrick | last post by:
Hi. I'm in the process of making a GUI for a function someone else wrote, and i've come across a type i'm unfamiliar with, namely "std::vector<unsigned char>". I need to get the contents of this...
3
by: chutsu | last post by:
I got errors: qu2-1.c:66: warning: format '%s' expects type 'char *', but argument 2 has type 'char (*)' qu2-1.c:72: warning: format '%s' expects type 'char *', but argument 2 has type 'char (*)'...
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
marktang
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,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.