|
Yes, specialization is supported. It's essentially overloading a template for a specific set of template params. Partial template specialization is one that's not supported (maybe it is "partially" - I still don't understand how it works).
template class CFoo<typename T>
{
public:
void DoStuff ( T t ) { ... }
};
template<> class CFoo<char>
{
public:
void DoStuff ( char ch ) { FormatDrive(ch); }
};
main()
{
CFoo<int> foo_int;
CFoo<char> foo_char;
foo_int.DoStuff(42);
foo_char.DoStuff('C');
} I think I have all the syntax right... templates are a PITA sometimes.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
i've never tried it before, how do i implement it?
thanks in advance.
|
|
|
|
|
Hi,
I'm writing a Win32 app (Non-MFC), is there a way i can implement linked lists without using CList (MFC)
|
|
|
|
|
You could use the STL equivilent, or just write your own linked list class. Its pretty easy to do.
|
|
|
|
|
CString m_string = "123.45221"
double the_double = (double)m_string;
iz not working.iz dat the right way to convert or type cast a CString object to double ??
|
|
|
|
|
<br />
#include <stdlib.h><br />
<br />
CString str = "123.45";<br />
double f = atof(str);
|
|
|
|
|
double strtod( const char *nptr, char **endptr );
Maxwell Chen
Lets make bugs better!
|
|
|
|
|
HI
I have created a window with CreateWindowEx and with toolbar style i want it to be fixed so that it cannot be resized. is there any special parameter to pass to make it fixed. PLZ do share the knowledge
|
|
|
|
|
If you don't want it sizeable, don't add the flags to make it sizeable - it's all in the documentation.
If you for some reason want a thick border (or sizebox, both are the same and both implies sizeable) but still want to prohibit the user from resizing the window (for whatever, malicious or not, reason), override the handling of WM_NCCALCSIZE.
It's spelled "Please", not PLZ.
|
|
|
|
|
thanks for ur consideration. i have find flags but could not find any if u know any let me know too.
|
|
|
|
|
I have an array of characters and I am trying to delete certain elements. The array conatains information about a file and has numerous blank and null spaces. I want to delete all of the null psces out of the array and also delete blank spaces that repeat throughout the array. I have an 'if' statement setup that recognizes if there are consecutive blank spaces or a null space. What is the command to then delete or remove the element at that point in the array. Thanks for the help.
Josh
|
|
|
|
|
as for as i know there is no way to delete the characters from array.better option is to take another array of chars and copy the non-null and non-blank chars to it. sorry if u dont like it.
|
|
|
|
|
I am pretty sure I know how to copy the elements to the other array. But the examples I have seen omit all of the characters that are not needed. I want to omit all of the null spaces, but I do need some of the blank spaces in order to separate words. Am I just trying to make this to complicated? I have found myself doing that a lot lately.
Josh
|
|
|
|
|
As a matter of fact u can "delete" the characters from the array, all u have to do is to copy the next character over the one u want it deleted, and that's it.
It's up to u to test if the next xharacter should be copied or left alone!
Papa
Murex Co.
|
|
|
|
|
You could use something like this:
delete_char(char* buffer,size_t length_buffer,size_t index)
{
memmove(buffer+index,buffer+index+1,length_buffer-index-1);
} Be aware this is very unefficient for large arrays, though it probably won't matter for the sizes you're handling.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello everybody,
Right now I'm creating an opengl activex control that allows JavaScript to communicate with the control. For example:
*********************************************
function begin()
{
var object = document.SGLworld;
object.StartRender();
}
function stop()
{
var object = document.SGLworld;
object.StopRender();
}
<object classid="clsid:4E14E2C5-A05D-466D-979A-97391CB899E8" width="200" height="200" id="SGLworld">
*********************************************
I plan on having the ability to pass class or struct objects back to a JavaScript variable like this:
*********************************************
function returnclass()
{
var box;
var object = document.SGLworld;
box = object.CreateBox(1.0, 1.0, 1.0); // return the createbox structure to the javascript variable(box)
box.SetColor(1.0, 0.0, 0.0); // now the varible(box) should have access to the structers members functions
}
*********************************************
But the problem is I have no clue how to pass struct(or class) objects back to a js variable! So if anybody has an idea or can redirect to some information I’d be very grateful!!!
Thanks,
Caleb
|
|
|
|
|
Have you tried SpiderMonkey? It's the javascript engine of the Mozilla project.
|
|
|
|
|
|
I am trying to access the partition data from the hard disk but I get an error 87 (Incorrect parameter) on the read file.
typedef struct tagPARTENTRY
{
BYTE bBoot;
BYTE bHead;
BYTE bSector;
BYTE bCyl;
BYTE bSysInd;
BYTE bEndHead;
BYTE bEndSector;
BYTE bEndCyl;
UINT unStartSect;
UINT unNumSects;
} PARTENTRY;
typedef struct tagDISKTABLE
{
CHAR cData[445];
PARTENTRY peTable[4];
WORD wSignature;
} DISKTABLE;
...
INT nDriveNum = 0;
CHAR szFileName[MAX_PATH];
DISKTABLE dtBuffer;
LARGE_INTEGER liSeekPos;
...
liSeekPos.QuadPart = 0;
wsprintf(szFileName, "\\\\.\\PhysicalDrive%d", nDriveNum);
hDevice = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
if (SetFilePointer(hDevice, liSeekPos.LowPart, &liSeekPos.HighPart, FILE_BEGIN) == 0xFFFFFFFF)
{
AtlTrace("Seek error %d", GetLastError());
return FALSE;
}
if (!ReadFile(hDevice, (LPVOID)&dtBuffer, sizeof(DISKTABLE), (LPDWORD) &dwBytesRead, NULL))
{
AtlTrace("Error reading from disk. error code = %d\n", GetLastError());
return FALSE;
}
...
I tried the same code by opening a file instead of a PhysicalDrive# and the ReadFile completed successfully. Any ideas?
-- I have also been able to get the geometry of the disk using the same handle. Do I need a differant type of handle or is it that I can't access the sectors on disk? I have seen DeviceIoControl commands to lock the volume, does the volume need to be locked before I can read from it?
Thanks in advance,
Clint
|
|
|
|
|
Try adding FILE_SHARE_WRITE also, even if you only open it for reading (if you think about it for a while it actually makes sense, sharing has nothing to do with the I/O direction - even that it looks wierd in this context - and the OS might want to write "last accessed time" or something). I seem to recall a problem with this.
|
|
|
|
|
Hi,
As we print to the printer, the size (will be changed according that printer resolution), there any function or class we can read the Printer resolution and adjust according in run time?
Thanks,
ATC
|
|
|
|
|
CDC::GetDeviceCaps
-c
Cheap oil. It's worth it!
|
|
|
|
|
Is there anybody who can give me code or tell me that "how can I get in array, the color values of a .bmp file after opening it(how to open for this purpose) with providing required x, y places to get specific image area in array "
I'll really be so thankful to you for your favour.
Thanks
|
|
|
|
|
Here at CP you can find Davide Pizzolato's CXImage, which does what you want (and a lot more.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
how to use combo box ?
i have one combo box on my dialog.
i write tray1 (ctrl enter) tray2 ....etc. in combo box, properties, data tab.
then i run the program. when i click on the arrow down key on combo box.. either one of whatever i typed in for data are there. it's empty. but if i click on somewhere of that empty box, the data is there. i just don't see it..
what did i do wrong so that data are invisible but there in the combo box.
|
|
|
|