|
Great ! Thanks !
~RaGE();
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
I wanted to convert my MDI app to SDI without having to start a new project. Is this possible for me to do without having to restart my project over and using app wizard?
thanks in advance.
|
|
|
|
|
Not without a lot of work (from my experience). By far, the easiest way is to create a "blank" SDI project and copy the necessary files over. You'll still have to tweak a few of the files, but it will be minimal.
|
|
|
|
|
I use lfCharSet can retrieve the character set, but I want to know the range of Unicode.
I want to know the relation between Unicode and the following?
#define ANSI_CHARSET 0
#define DEFAULT_CHARSET 1
#define SYMBOL_CHARSET 2
#define SHIFTJIS_CHARSET 128
#define HANGEUL_CHARSET 129
#define HANGUL_CHARSET 129
#define GB2312_CHARSET 134
#define CHINESEBIG5_CHARSET 136
#define OEM_CHARSET 255
|
|
|
|
|
Alice80 wrote:
...I want to know the range of Unicode.
It can handle 65,536 character combinations rather than just 256.
Alice80 wrote:
I want to know the relation between Unicode and the following?
I'm not sure what you are asking here. Unicode, also known as DBCS, uses two bytes for each character rather than one.
|
|
|
|
|
I want to know a font's character set and I want to know the character set position in unicode.
|
|
|
|
|
Perhaps you are looking for GetTextMetrics() and GetFontUnicodeRanges().
|
|
|
|
|
Hi
i have a CString which contains positive and negative numbers
im trying to loop through the string to extract each set of
numbers
mystring = "-21212,23123,4455656,-8484848,938383";
however, i keep losing my place in the list,
i need some way of indexing my string so i can loop through it
does ne1 have any ideas, cos this sending me mad
thanks
si
|
|
|
|
|
Hum, this can be done using the strtok function (take a look at the doc). But this works with char* and not CString.
Here is an example:
char szString[255];<br />
strcpy(szString,mystring.GetBuffer(254));<br />
<br />
char* token = strtok(szString,",");<br />
while(token)<br />
{<br />
int Value = atoi(token);<br />
token = strtok(NULL,",");<br />
}
And store Value in a table !
Hope this helps!
|
|
|
|
|
Yep, but I'd make a couple of modifications. Use _tcstok() so it supports unicode as well, replace char with TCHAR , and you don't need to call GetBuffer() on the string.
TCHAR szString[255];
_tcscpy(szString,(LPCTSTR)mystring);
TCHAR* token = _tcstok(szString,_T(","));
while(token)
{
int Value = _ttoi(token);
token = _tcstok(NULL,_T(","));
} As long as the string is less than 254 characters long it will work nicely
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Yep! Nice idea
A better solution would to allocate dynamically the string (so retrieve the length of mystring). But this was just an example so it was not perfect !
|
|
|
|
|
cedric moonen wrote:
A better solution would to allocate dynamically the string (so retrieve the length of mystring).
Yeah, but I just thought of an even better way! Let CString do the dirty work for you
CString str = mystring;
TCHAR* token = _tcstok(str.GetBuffer(), _T(","));
while(token)
{
int Value = _ttoi(token);
token = _tcstok(NULL, _T(","));
}
str.ReleaseBuffer();
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hhhmm, yep, but don't forget that _tcstok will modify the contains of the string !
|
|
|
|
|
cedric moonen wrote:
Hhhmm, yep, but don't forget that _tcstok will modify the contains of the string !
Yeah, which is why I made a copy of it first
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I think I'm tired !
|
|
|
|
|
cheers Ryan,
works a treat
si
|
|
|
|
|
You're welcome
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Such, an Idea!
int pos=0;
int last=-1;
CString help;
while(pos!=-1)
{
pos=mystring.Find(",",last);
for(int i=last+1;i
|
|
|
|
|
I use the undocumented function AfxExtractSubString() . It's slower than a proper solution, but I haven't had to do time-critical stuff. The function is declared like:
BOOL AfxExtractSubString(CString& rString, LPCTSTR lpszFullString, int iSubString, TCHAR chSep); rString is the output stringlpszFullString is your input stringiSubString is the number of the substring you want to get (0, 1, 2...)chSep is the separator character, ',' in your case Just do something like this:
CString str;
int i = 0;
while(AfxExtractSubString(str, mystring, i++, _T(',')))
{
} Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
would it be easier to make it a vector of strings?
*.*
|
|
|
|
|
The program below compiles with no errors and seems to run ok, but it doesn't work properly. When I enter in one of the 13 digit numbers stored in the array, I get back a message saying that the number I input is NOT in the array (but it is). What do I need to change?
Thanks, Dave
-------------------------------------------------------
#include "stdio.h"
#include "math.h"
#include "iostream.h"
#include "stdlib.h"
double values[] = {5758020005287, 7937030006574, 4748020008574,
4847020007584, 9500020004758, 3849573800596 ,5758020005007,
7557030006574, 4745520008574, 4847020005584, 9585520004758,
3849573846696 ,3748596078661 , 4615243374995 , 1115364759770};
int compare (const void * a, const void * b)
{
#define ABS(a) ((a) < 0 ? -(a) : (a) )
double _a = *(double*)a;
double _b = *(double*)b;
if( ABS(_a - _b) < 0.00000001 )
return 0;
else if( _a < _b)
return -1;
else
return 1;
}
int main ()
{
double * pItem;
cout<<"please enter a number"<<endl;
double="" key;
cin="">>key;
pItem = (double*) bsearch (&key, values, 15, sizeof (double), compare);
if (pItem!=NULL)
printf ("%lf is in the array\n",*pItem);
else
printf ("%lf is not in the array\n",key);
return 0;
}
VC++ 6.0
|
|
|
|
|
|
From the documentation:
Performs a binary search of a sorted array.
|
|
|
|
|
Thanks, that did the trick.
|
|
|
|
|