|
These kinds of bugs are among the most aggravating.
CString changed drastically between 6 and 7. The new CString is a typedef of CStringT which is derived from CSimpleStringT. Unfortunately, while I knew the old CString like the back of my hand, I am just getting acquainted with the new.
One thing to check for is a buffer overrun. The old CString used a fixed memory allocator pool which meant that depending on the size of the string, you could do a GetBuffer() then copy more data to the string than you had requested be allocated. Of course, this would usually be caught in debug mode, but it's worth a look.
(That your problem is with the memory points me in this general direction.)
My only other suggestion is to write a test program and break out chunks of code and test them in it. (And if my experience is normal, the test program will probably grow into a hideous monster, but it may help.)
And nothing beats just stepping through the code, line by line.
|
|
|
|
|
What does this work
unsigned long (*array)[256];
array = new unsigned long[4][256];
and this does not
unsigned long* array[256];
array = new unsigned long[4][256];
error C2440: '=' : cannot convert from 'unsigned long (*)[256]' to 'unsigned long *[256]'
Todd Smith
|
|
|
|
|
Compare this:
char* ptr;
char arr[10];
ptr = arr;
with
char* ptr;
char arr[10];
arr = ptr;
Static arrays can be seen as const pointers - static arrays can only point to what it was initialized with.
Basically the same thing going on with your error, with the difference that the error lies on another level of indirection.
--
Please state the nature of your medical emergency.
|
|
|
|
|
Todd Smith wrote:
array = new unsigned long[4][256];
Is that even legal? I thought you could only allocate one-dimensional arrays with new .
But the difference bewteen the two declarations is the types.
unsigned long (*array)[256];
"array" is a pointer to an array of 256 long.
unsigned long* array[256];
"array" is an array of 256 long*
Totally different beasts.
--Mike--
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Is is possible to turn the following macro into a template? I'm unsure about the ##i.
#define S(x,i) (SBoxes[i][x.w.byte##i])
Todd Smith
|
|
|
|
|
Working with the blowfish encryption ???
The ## operator with the proprocessor only works because it modifies the code before the compiler gets to it.
1) You could accomplish the same things but you will need to change the main data block union that is used to array notation and that would work.
2) Or you could change the bf_F macro to send in the name of the variable.
I would probably do the first suggestion if you dont like the macro syntax.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
I'm not sure.
Templates needs to be figured out at compile time - not before and not after. Your piece of code is first transformed pre compile time (##-operator) and runtime - access of instance data.
Since x and i seem to be runtime data, this model would probably not work well using templates. However, I'm sure if you'd redo the whole model to suit templates there is most likely a solution.
--
Please state the nature of your medical emergency.
|
|
|
|
|
Hello, Im trying to create a simple win32 application that will popup with a messagebox which shows the data a specific key in the registry.
The only thing I can't figure out is how to access the registry and dump the data in the key I need. I searched on MSDN.microsoft.com but I didn't find anything..
Thanks
|
|
|
|
|
Read the 8th posting below this one.
|
|
|
|
|
You can find several classes here in CP to Access the regsitry...
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Ok. I had a post earlier about my app failing in release mode. Thanks, to some help on here, I thought I had it narrowed down to the MSFlexgrid.ocx control delivered with VS6. I have read and was told that to redistribute the control you must have a runtime license embedded in your application.
The wierd thing is that another developer that I work with was able to distribute his control on a PC w/o VS6 installed, and it worked. Blew me away. So, I duplicated what he did and it worked too.
The method? Ensure that the control is in your resource workshop toolbox by Project | Add To Project | Components and Controls. Once, it's there you must add it to your dlg or form view, using the class wizard so it will DDX it for you. U see, I sometimes don't use the class wizard since I was dynamically creating and deleting the grid controls and a tab control. I've changed this approach now to just statically use the controls and make visible/invisible what I don't want the user to see.
Apparently, this somehow embeds the license into it??? Cuz, I simply ran the install program (which only copies and registers the control) and it works fine, now.
Go figure!! Anybody know about why this works?
|
|
|
|
|
What do you think of making a Boehm GC - Object Oriented framework for interacting with Windows?
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
|
Perhaps I'm not clean enough.
While the Boehm GC exists, there is no User Interface Framework nor a framework that interacts with the Windows API (for the public developer) which uses it. (If so, please respond)
LPCTSTR Dutch = TEXT("Double Dutch ");
|
|
|
|
|
Hio guys.. i am currently running a program using the following code.. it runs the other program and continues on instantly.. is there a way to run a process and wait for it to finish before continuing on? here is what im using right now:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
char cmdline[300];
sprintf (cmdline, strExePath);
if( !CreateProcess( NULL,
cmdline,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi )
)
{
CString strTemp = "Unable to open file:\n" + strExePath;
AfxMessageBox(strTemp);
return FALSE;
}
thanks for any pointers!
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
try :
// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );
|
|
|
|
|
I have a text file generated by another program called:
test.txt which contains:
a|b|c|d|f
g|h|i|j|k
l|m|n|o|p
I know how to use token to split the string, but how can I parse out information from a text file, split it up and then store it into the database?
Thanks
vinnie
|
|
|
|
|
|
Daniel,
Do you have example codes? Does C++ have BCP capability?
Thank You
|
|
|
|
|
|
Thank You Daniel. I went to the site, scan thru the code a little.
I think this is what I need. You are very very helpful.
Thanks.
|
|
|
|
|
I want to develop a program in VC++, that runs in background; i mean that the program has no user interface and runs silently. The motive of this program is that it downloads certain file from internet, and when downloading completes, a dialog box is displayed. I've developed all the core logic and download coding etc. But now i want this program to run as a "silent" application in background.
Can any one tell me how can i convert my application to "invisible" form ????
|
|
|
|
|
check ShowWindow
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Papa wrote:
check ShowWindow
My program is not necessarily a windows application. I want to run it as a "process" and not "application". Just when you see windows task manager in Win2k, there are two tabs, "applications" and processes". I want to run my program as a process and not as an "application", and this difference is something that i am unable to understand
|
|
|
|
|