|
|
TheGroinalRampager wrote:
if I hadn't i believe it would have a different error along the lines that _T would not a be a declared macro....
no, _T() is declared for both Unicode and ansi. this is for allowing compilation for unicode and ansi without changing the code...
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 7:32 Tuesday 30th August, 2005
|
|
|
|
|
Ok thx didn't know that but still, I have definately declared both the UNICODE macros, if I remove them it says:
error C2440: '=' : cannot convert from 'const char [16]' to 'CHAR [32]'
instead of (with #define _UNICODE and #define UNICODE):
error C2440: '=' : cannot convert from 'const unsigned short [16]' to 'WCHAR [32]'
So maybe the question is why is the UNICODE macros turning my string into and unsigned short and not a WCHAR?
|
|
|
|
|
because the operator = () don't copy the contents of the C-style strings but only the addresses of the pointers...
does this error occur with strcpy() ? i doubt...
you could use strncpy() also if you want to copy not the totality of the string but a part...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Yes it is WCHAR, I have already included the #define UNICODE and #define _UNICODE line, if I hadn't i believe it would have a different error along the lines that _T would not be a declared macro....
|
|
|
|
|
The Groinal Rampager wrote:
sFontDetails.FaceName = _T("Times New Roman");
it is just as if you were doing this :
char* psz = "Hello";
char tab[10];
tab = psz;
use <a href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strcpy.2c_.wcscpy.2c_._mbscpy.asp" rel="nofollow">strcpy()</a>[<a href = "http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strcpy.2c_.wcscpy.2c_._mbscpy.asp" target = "_blank" rel="nofollow">^</a>] and/or wcscpy()
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
The problem with doing that is doesn't it stop the code from being able to be compiled in both ansi and UNICODE since i would have wcscpy() in my code? I suppose some macros could fix it but i would rather just use the _T macro which is how MSDN says it should work.....
thx again though
|
|
|
|
|
hum, yes, but you can now define a macro like this :
#if defined(_UNICODE)
#define _MBCSCPY wcscpy
#else
#define _MBCSCPY strcpy
#endif
now, you can use it just like that :
#include <string.h>
TCHAR* psz = "Hello";
TCHAR tab[10];
_MBCSCPY(tab, psz);
_tcscpy(tab, psz);
it will use strcpy() if _UNICODE is not defined, wcscpy() otherwise.
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 8:44 Tuesday 30th August, 2005
|
|
|
|
|
toxcct wrote:
hum, yes, but you can now define a macro like this :
#if defined(_UNICODE)
#define _MBCSCPY wcscpy
#else
#define _MBCSCPY strcpy
#endif
Or simply use _tcscpy , which is already defined with the same purpose
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
yes,
thanks for the info, i did not read the msdn page to the end...
i updated my post consequently.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi,
sFontDetails.FaceName is an array of character, you cannot simply do this
sFontDetails.FaceName = _T("Times New Roman");
So use _tcscpy() it will work fine for you
" Action without vision is only passing time,
Vision without action is merely day dreaming,
But vision with action can change the world "
- Words from Nelson Mandela
Thanks & Regards,
Gopalakrishnan
|
|
|
|
|
did you bother read the other posts on that thread ?
all you said were already answered...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thanks everyone, tried _tscpy and it worked like a charm:
_tcscpy(sFontDetails.FaceName, _T("Times New Roman")); //no problem
Learning C++ having done C# is clearly giving me some problems. Anyway thanks again to all who helped...
|
|
|
|
|
Respected all
Regards!
I am david and have a problem.
I have a number of images that store on disk i want that when i run my program all the images readed once and then store in memory temorarily and then displaying from memory rather reading one by one from desk.
plz guide me.
from
david
|
|
|
|
|
First you have to make some memory dcs. I think you can!
Then load the images to that dcs with LoadImage(...).
You can then use those dcs anytime you want to show the images.
OK?
|
|
|
|
|
Use the CImageList class or create your own array of CBitmaps.
This assumes you are using MFC.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
I want to specify a sound card for windows media player but keep the windows default sound card unchanged (i.e., windows use another sound card). By the use of DirectSound, I can enumerate all sound cards in my system.
So, after I obtained the GUID of the sound cards, how can I specify a GUID for the windows media player? Also, how can i specify another GUID for the system as its default sound card?
Thanks for your kindness help!!!
|
|
|
|
|
i want to know how to get SSL Certificate for my SSL Socket
thanx in advance
-- modified at 4:44 Tuesday 30th August, 2005
|
|
|
|
|
Hi
I will link an object of C module with a simple Win32 console application,
but became link errors. For example i have written a "void SomeFunc()" function in C module and declare it in testMain.cpp(Win32 API cpp module)as:
extern void SomeFunct(void);.
When i link this object, the result is:
1- SomeObject.obj : error LNK2005: _SomeFunc already defined in SomeObject.obj
2- testMain.obj : error LNK2001: unresolved external symbol "void __cdecl SomeFunc(void)" (?SomeFunc@@YAXXZ)
3- Debug/testMain.exe : fatal error LNK1120: 1 unresolved externals
Therefore, i try to declare it as:
extern "C" void SomeFunc(void);
When i link this object, the result is:
1- SomeObject.obj : error LNK2005: _SomeFunc already defined in SomeObject.obj
2- Debug/testMain.exe : fatal error LNK1169: one or more multiply defined symbols found
I don't know why? I will be thankful, when everybody can help me.
Best regards, Alireza
|
|
|
|
|
alireza_shokoie wrote:
1- SomeObject.obj : error LNK2005: _SomeFunc already defined in SomeObject.obj
You seem to be including SomeObject.obj twice, most likely from diferent locations.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hai
Please tell me the different reports available in vc++.
Except using Crystal Reports.If any sample code available ,send me please.
Jeeva
|
|
|
|
|
Does anyone know a free C++ .NET complete tutorial in English or Italian? Note that I already develop with the other .NET languages...
Thanks for sugestions.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
|
sorry...
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is obliterating us.
|
|
|
|
|
hey...
i have to read a text file which looks like this..
1 sdfdf
2 dasdsad
3 fgggg
4 dfdffd
5 yhgtr
. .
. .
. .
i require to position pointer at any certain place then read the file backwards using fscanf... positioning can be done by using the index but how to read the file backwards with fscanf()...(e.g from 3 to 1)...plzz help
|
|
|
|