|
What language are you trying to store?
Unicode handles every language available on the planet (including Klingon, Vulcan and Welsh) with a lot of room left for new languages. So unless you have invented some new language, UNICODE will work.
What are you actually trying to do?
Neil
|
|
|
|
|
ok thanks
I thought that there might be a case where I have to handle more than 2 bytes size and the software should not fail.
anyways Is this possible or impossible ?
|
|
|
|
|
Answer is simply no. you cant do it in VC++ atleast, but you can always design your application to store more than 2 byte per char, but none of the windows api will be of any use coz they accept either ascii or unicode character set.
-prakash
|
|
|
|
|
The 32 bit versions of unicode handle everything. The 16 bit versions miss a lo. (mostly Asain languages where there are a different symbol for each word) Windows is mostly 16 bit unicode.
UCS-8 (which is common on unix) is variable size, IIRC it can use up to 6 bytes, or as little as 1.
|
|
|
|
|
are there any special reasons for that you could explain fully here ?
UNICODE provides 2 bytes per character, that allow you to have 65535 different characters in the same "set", which is large enough to represent all the characters of the world...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
hmmm - does it support those elven-characters from Lord of the Rings ?
|
|
|
|
|
Yes you can use unicode. However you cannot use the uncode functions built into windows, because they use UCS-2 which is only 16 bit.
I would typedef unsigned long to something like my_unicode_type, so that if you come up with something better latter you only need to change your type in one place. This depends though, if you are writting a class to wrap everything it might not be required.
|
|
|
|
|
I use Teradata database.
Teradata has a SQL Statement :show table mytable;
This statement can return the definition of mytable.
But CRecordset class cann't run this SQL.
CDatabase can do it,but CDatabase.ExecuteSQL function has no return .
strSQL = "Show table mytable;";
set.Open(CRecordset::forwardOnly,(LPCTSTR)strSQL,CRecordset::none);//Error !
database.ExecuteSQL(strSQL);//OK,but how can I get the result?
How can I run this SQL and get the result?
Thanks.
|
|
|
|
|
willyfu wrote:
How can I run this SQL and get the result?
Getting the results from a stored procedure is not that difficult. One way of doing it is shown in MSDN article Q183001.
Here is another.
Here is a helpful discussion.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
finally,I found the ODBC API solution.
CString strSQL;
SQLLEN nRecCount,nFieldLen;
strSQL.Format("Show table mytable;");
CRecordset set(&database);//Create a CRecordset object
SQLExecDirect(set.m_hstmt,(SQLCHAR*)strSQL.GetBuffer(strSQL.GetLength()),strSQL.GetLength());
SQLRowCount(set.m_hstmt,&nRecCount);
for(int n = 0;n < nRecCount; n++)
{
SQLFetch(set.m_hstmt);
SQLGetData(set.m_hstmt,1,1,str1.GetBuffer(32000),32000,&nFieldLen);
str1.ReleaseBuffer();
}
that's all.
|
|
|
|
|
While it may work, this is a very odd use of a CString object. I'm curious why you are using a CRecordset object if all you need access to is its m_hstmt member.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a prjt which compiles without errors, but keeps displaying an error message on execution. The error message is only supposed to appear when a certain variable x, is less than or equal to zero. Only one function calls the function that contains this error message. Even after "ensuring" that x has a postive variable, I still get the error message on execution.
My fxn which contains the error message is as follows:
<br />
void ei(double *x, double *expi, int nSize)<br />
{<br />
enum{nSize = 100};<br />
const int MAXIT = 100;<br />
const double EULER=0.577215664901533;<br />
const double EPS=1e-20;
<br />
<br />
<br />
int k;<br />
double fact[nSize], prev[nSize],sum[nSize],term[nSize];<br />
<br />
for(int t=0;t<nSize;t++)<br />
{<br />
if (x[t]<=0.0)<br />
{<br />
AfxMessageBox("x value incorrect, in ei!", MB_OKCANCEL|MB_ICONSTOP);
exit(1);<br />
}<br />
<br />
if (x[t]<EPS)<br />
{<br />
expi[t]=log(x[t])+EULER;
}<br />
<br />
if (x[t]<=-log(EPS))<br />
{<br />
sum[0]=0.0;<br />
fact[0]=1.0;<br />
<br />
for (k=1;k<MAXIT;k++)<br />
{<br />
fact[t] *= x[t]/k;<br />
term[t]=fact[t]/k;<br />
sum[t] += term[t];<br />
if (term[t]<EPS*sum[t]) break;<br />
}<br />
<br />
if (k>MAXIT)<br />
{<br />
AfxMessageBox("Series failed in ei!",MB_OKCANCEL|MB_ICONSTOP);<br />
exit(2);<br />
}<br />
<br />
expi[t]=sum[t]+log(x[t])+EULER;<br />
}<br />
<br />
else<br />
{<br />
sum[0]=0.0;<br />
term[0]=1.0;<br />
<br />
for (k=1;k<MAXIT;k++)<br />
{<br />
prev[t]=term[t];<br />
term[t] *= k/x[t];<br />
<br />
if (term[t]<EPS) break;<br />
<br />
if (term[t]<prev[t]) sum[t] += term[t];<br />
<br />
else<br />
{<br />
sum[t] -= prev[t];<br />
break;<br />
}<br />
}<br />
<br />
expi[t]=exp(x[t])*(1.0*sum[t])/x[t];<br />
}<br />
}<br />
}
the only place where the above function is used is:
<br />
void unbound(double *unbd, int nSize)<br />
{<br />
enum{nSize = 100};<br />
double A[nSize],B[nSize],k0[nSize],k1[nSize],s[nSize],expi[nSize],a[nSize],b[nSize];<br />
<br />
s[0] = 1;<br />
for (int t=1;t<nSize;t++)<br />
{<br />
double x;
<br />
CKuchukDlg MyClas; <br />
MyClas.m_dWellRad = x;<br />
<br />
void bessk0(double *x,double *k0,int nSize);<br />
void bessk1(double *x,double *k1, int nSize);<br />
void ei(double *x, double *expi, int nSize);<br />
<br />
s[t] = 2*t*PI;<br />
a[t] = x*sqrt(s[t]);<br />
b[t] = 2*sqrt(s[t]);<br />
<br />
bessk0(a,k0,nSize);<br />
bessk1(a,k1,nSize);<br />
ei(b,expi,nSize);<br />
<br />
A[t] = k0[t]/(x*sqrt(s[t])*k1[t]);<br />
B[t] = (1-exp(-2*sqrt(s[t])))/(2*sqrt(s[t]));<br />
<br />
unbd[t]=0.5*(A[t]-B[t]-expi[t]);<br />
}<br />
}<br />
could someone please tell me where im missing it? Thank you!
|
|
|
|
|
I need someplace where I can filter all application messages of the application (main window and all child windows and dialogs).
|
|
|
|
|
Look into SetWindowsHookEx
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Hi guy!
I am formatting html tags from my vc application. I need to print tickets in each page separatedly. Do we have any tags for page break. So that each ticket is printed in a separate page! I would be grateful if anybody can help!
Thanks.
|
|
|
|
|
I'm not sure if this will help, but:
You may want to look into the css attribute page-break-before . I think that's it...
HTH
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Hi All,
I am using static control on a dialog box in MFC.The text which is to be shown in the static control is to big to fit in it so its gets crop (half text displayed).Is there any way by which i can acheive text wrapping in the static control?
Thanks
Pushkar
|
|
|
|
|
The text is automatically wrapped in a static control. Increase the rectangle size vertically in the resource editor.
You can try to do that at run-time too and for that you will have to increase the static box size w.r.t the number of possible lines.
|
|
|
|
|
Thanks Genius_Logics,
I tried the solution given by you but it is not working. I increased the size of static control vertically but still text gets cropped
Any guess?
Thanks
Pushkar
|
|
|
|
|
well.....
this idea might sound stupid(and there might be a better way to do it,well anyway.....)
u c the CStatic control doent seem to have function that could change itz size......BUT it happenz to be derived from the CWnd class(aaaahaa!!!!!).....lol.....so u can try to use the function.....
mystaticobject.SetWindowPos(.....)
where mystaticobject is an object of CStatic.....so based on the lenght u can make a code that could keep changing the height of the static window
tis just a suggestion.....and hope it will help.....
happy programmin.....
cheerz.....
|
|
|
|
|
I have a check box in my dialog, and make it as a push like style. And i want to show some bitmap over it. so i declare a cbitmapbutton object, and create the cbitmapbutton object with a owner draw style, then attach the check box with the cbitmapbutton object using the function: autoload. But I found the cbitmapbutton's drawitem function won't be called when we show the check box!! Could i owner draw the check box? (when i just use a button, this is no problem)
Thanks a lot
|
|
|
|
|
Hey,
I want to use macros in my application.
Can any one tell me the effect of Macros on performance of application and the reasons behind it.
Thanks a lot,
Amit.
|
|
|
|
|
There is no runtime performance hit when using macros. They are expanded/inlined by the preprocessor.
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
macros are #define s, that means that the preprocessor copies its definition where the macro was called, like inline functions are.
but BE CAREFUL, macros can be very bad. consider the following :
<font color=#0000FF>#define</font> INCRZ(xx) xx + 1
if you then call this :
<font color=#0000FF>int</font> i = 2;
INCRZ(2); <font color=#008000>
OK, i == 3 at the end.
and what about this ? :
<font color=#0000FF>int</font> i = 2;
i = 5 * INCRZ(i)<font color=#008000>
BAD CODE !! here is how the preprocessor inlines the macro :
i = 5 * i + 1;
At the end, i is evaluated as : i = (5 * i) + 1; because you might know that multiplication is prior on addition.
be careful so when designing macros, and put a maximum af parenthesis :
<font color=#0000FF>#define</font> INCRZ(xx) ((xx) + 1)
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hello
Could anyone please tell me the difference between memory address space and I/O address space.
/sreekanth
|
|
|
|