473,503 Members | 12,367 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3555
>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
2125
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
1739
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
2479
by: Matt | last post by:
Hi, I have a probelm here: If I declare: char *p="Hello";
15
2742
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
2099
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
348
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
14086
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
19956
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
4736
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
7098
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
7296
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
7364
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
5604
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,...
1
5026
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...
0
4696
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...
0
3186
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...
0
3174
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
405
bsmnconsultancy
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...

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.