|
Hi
I have a array of WCHAR type and my data is in buffer in unicode format whenever i try to read byte from buffer it add some nonprintable character at last .
And if i try to read byte in char array it just display only first character.
what is the reason
manu
|
|
|
|
|
post some code ? Probably your end of string char does not match.
|
|
|
|
|
WCHAR *m_pbytTemp=new WCHAR[From-To+1];
memset(m_pbytTemp,0x0,From-To);
memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To);
m_pbytTemp[From-To]=L'\0';
manu
|
|
|
|
|
manu_2205 wrote: memset(m_pbytTemp,0x0,From-To);
memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To);
memset(m_pbytTemp,0x0,From-To);
Use wmemset() while working with Unicode!
memcpy(m_pbytTemp,&m_pbytFileBuffer[To],From-To);
Similarly use wmemcpy() !
Nobody can give you wiser advice than yourself. - Cicero
ப்ரம்மா
|
|
|
|
|
But m_pbytFileBuffer is of Byte *(to hold the bytes)
manu
|
|
|
|
|
Then shouldn't you be using something like W2A() ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Please delete previous message its not good idea write a message without title and do you have any questions?
|
|
|
|
|
Hi,
I am working in a project in VC++ using MFC and recently while building and linking the project I get warnings like:-
Airways.obj : warning LNK4006: "unsigned short DBP_NWPT_LON_SB" (?DBP_NWPT_LON_SB@@3GA) already defined in Airport.obj; second definition ignored
Initially i ignored this warning but as the lines of code increased beyond 3000 so was the amount of warnings that I get...
Can anyone plz help me in resolving these warnings?? I am in dire need of getting rid of them as i hav to finish my proj this week...
Thanks..
Shiva Priya
|
|
|
|
|
no I don't hav a second definition..thats the prob naa..
unsigned short DBP_NWPT_LON_SB;
this is the only declaration...somewhere it is getting included twice though i hav put the definition #ifndef...#endif statement..
u know any other reason due to which it gets included more than once??
Thnx..
Priya.
|
|
|
|
|
I guess you have declared this variable in two cpps .
Otherwise, I dont see any reason for this error.
|
|
|
|
|
have you considered usingt the extern keyword ?
|
|
|
|
|
shivapriyak wrote: no I don't hav a second definition..thats the prob naa..
unsigned short DBP_NWPT_LON_SB;
this is the only declaration.
Actually that is both a declaration and a definition. You use the extern keyword to make it just a declaration. i.e.
extern unsigned short DBP_NWPT_LON_SB;
This is what toxcct was alluding to above.
Steve
|
|
|
|
|
When you compile a .cpp file (or a .c file) an .obj file is produced. The linker links all these .obj files together to produce the finished program. Your error message means that the file "Airways.cpp" (or "Airways.c", I can't be sure) contains a definition of DBP_NWPT_LON_SB and so does the file "Airport.cpp" (or "Airport.c", I can't be sure). The linker knows; this is the case.
Steve
|
|
|
|
|
Hi,
I am new to VC++ and i am currently working on a project in VC++.
I keep getting the error LNK 2001:unresolved external symbol "double __cdecl ut_asin(double)"
I get this error only while linking..not during complilation!!
I have a declaration as:
double ut_asin( double a );
whose definition is given in math.h
Can anyone help me to resolve this error??
Thanks,
Shiva Priya.
|
|
|
|
|
shivapriyak wrote: double __cdecl ut_asin(double)"
Where it is defined ? Linked is not able to find it.
|
|
|
|
|
Thnx for the immediate reply..
see i hav a file as ut_math.h in which the math.h file is included...
This file has macros like:
#define mqerASN ut_asin
#define fasin ut_asin
Now, I have included ut_math.h in a file called as Common_func.cpp where this method is used as:
DDIST_B = ut_asin( DDIST_SIN_ANG_SIN_RATIO * sin( DABS_ANG_B ) ) * FIXED_EARTH_RAD;
This is what I have done and I started getting the linking error.I hope you got my prob.
Thnx
Shiva Priya.
|
|
|
|
|
You have not answered question , where is ut_asin is defined ?
|
|
|
|
|
double ut_asin( double a )
{
if( fabs(a) < 1.0 )
return asin(a);
else if( fabs(a) < 1.00001 )
return (double)(mqerSGN( asin((double)1.0), a));
}
this is the definition of ut_asin in a file called as ut_math_e.cpp
thnx,Priya
|
|
|
|
|
shivapriyak wrote: ut_math_e.cpp
Does this this file is included in project and compiling ?
|
|
|
|
|
shivapriyak wrote: this is the definition of ut_asin in a file called as ut_math_e.cpp
Is ut_math_e.cpp being compiled?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
shivapriyak wrote: I have a declaration as:
double ut_asin( double a );
whose definition is given in math.h
Can you explain more in detail what you mean by that ? I never heard about a function called ut_asin in the math library (I might be wrong this looks strange to me).
What did you do exactly ?
You probably provided yourself a function prototype and forgot to define the body of the function. Can you post some relevant code (and don't forget to use the pre tags)
|
|
|
|
|
Thnx for the immediate reply..
see i hav a file as ut_math.h in which the math.h file is included...
This file has macros like:
#define mqerASN ut_asin
#define fasin ut_asin
Now, I have included ut_math.h in a file called as Common_func.cpp where this method is used as:
DDIST_B = ut_asin( DDIST_SIN_ANG_SIN_RATIO * sin( DABS_ANG_B ) ) * FIXED_EARTH_RAD;
This is what I have done and I started getting the linking error.I hope you got my prob.
Thnx
Shiva Priya.
|
|
|
|
|
|
You got to understand that compiling and linking are different things and steps in building a program.
I think you got to include the lib, I guess the "math.lib" in your project settings.
Greetings from Germany
|
|
|
|