|
Here is how it can be done, but its real ugly -
#define FIXED_SIZE 16
void allocate(long (**ptr)[FIXED_SIZE])
{
*ptr = new long[10][FIXED_SIZE];
}
int _tmain(int argc, _TCHAR* argv[])
{
long (*ptr)[FIXED_SIZE];
allocate(&ptr);
delete [] ptr;
return 0;
}
The clean and recommended way is to use a standard container - std::vector<std::vector<long>> longArr;
|
|
|
|
|
I guess the answer is, "you can't allocate a single pointer to an array without the new[] operator" (with brackets). So, to allocate a single pointer to an array you have to do:
long (*val)[16] = new long[1][16];
...
delete[] val; Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
This is a single pointer to an array -
long* ptr = new long[16];
delete [] ptr; Now I'm not sure what you're looking for.
|
|
|
|
|
Your last post solved it... I just can't allocate a SINGLE pointer to an array of pointers without dynamically allocating an array of 1 pointer to the array. For example:
long *(*val)[16] = new ???;
...
delete val; There is nothing I can put in the "???" area to make the above code valid, because there is no valid syntax to dynamically create a single pointer to array using operator new(). I must do the following instead:
long *(*val)[16] = new long*[1][16];
...
delete[] val; In short, you have answered my question. Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
|
Hi,
I restricted my SDIapplication to resize usin
m_pMainWnd->ModifyStyle(WS_MAXIMIZEBOX|WS_THICKFRAME,0);
But a thick border is coming around the window. how to remove that?
|
|
|
|
|
That's the default for resizable dialogs, why do you want to change that ?
|
|
|
|
|
I dont want resize proprty, how to restrict it.
I need fixed size dialog.
|
|
|
|
|
Which window styles remain now after removing those? Some styles imply WS_THICKFRAME, like WS_TILEDWINDOW.
Maybe have a look here[^] to find out which style does what.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Hello All,
I've one application which loads a dll into process using VirtualAllocEx, WriteProcessMemory and CreateRemoteThread, Now when the runtime library is selected as "MultiThreaded Debug /Mtd" it works fine in local computer but i can't run the application in other computer as it gives error regarding the configuration of file, To make this work i change the runtime library as /Mt (Multi Threaded) which actually works in any computer when i stop my antivirus, else the antivirus deletes the exe as soon as i build it.. How can i make this work.
Thanks.
|
|
|
|
|
Hi, I am trying to develop a win32 dialog based application.
When I tried to build my application, I am getting the following error.
error PRJ0003 : Error spawning 'cmd.exe'
Can anybody tell me a way to resolve this issue.
Thanks in advance
msr
|
|
|
|
|
|
Hi All,
How can i convert a char array into CString?
I have one array like this
char charr[1000];
....
drwFile.Read(charr,500); //reading some characters from the file
CString str;
how to store the charr array in to str?
i m try this CString str(charr);
but when i display a message box with str value its display only first character of charr.
please help me for this.
thanks in advance.
|
|
|
|
|
if this CString str(charr); doesn't work, then the problem may be with your character array. Does it contain what you expect?
|
|
|
|
|
Check the encoding used in file.
|
|
|
|
|
As already suggested by Rejeesh.T.S if your text file contains wide characters and your application doesn't use the UNICODE charset then the output posted is the expected result.
Hence either make a UNICODE build or use MFC/ATL conversion macros in you project.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You're probably not using a UNICODE build.
You could either change Project -> Properties -> Configuration Properties -> General -> Character Set to Use Unicode Character Set or try using CStringW and MessageBoxW .
|
|
|
|
|
Is there any way to bold a part of string.
like , this is bold
|
|
|
|
|
To keep this info along with the text, better is to go for Rich Text Format (RTF).
|
|
|
|
|
please give any example to use with MFC
|
|
|
|
|
Open wordpad, type some thing as you shown, save it as .rtf, open it in notepad and see the format. Its an example for format of rich text. Rich edit control in windows uses the same format to set and retrieve rich text. see CRichEditCtrl::StreamOut, as an example, try it
|
|
|
|
|
That really depends on how you display your string. A string doesn't contain any visual information, it is just a sequence of characters. The way you draw this string determine how it will be displayed. If you don't provide any more information about how this string is displayed (is it drawn using CDC::DrawString, part of an edit control, ...) we won't be able to help you much.
|
|
|
|
|
Hi,
I have created a application with 3 views in a child view of mainframe.
Around the child view, a thick line has been drawn, how to remove it?
|
|
|
|
|
How did you create the child view and the 3 views inside it?
Please post some relevant code.
Is the line drawn around each of the 3 views or around the child view?
|
|
|
|
|
Hi all,
i m using MCIWndPlay to play sound file.
when i m execute the command MCIWndPlay,its increase the threads counter but in diffrent manner,some time its generate 1 thread or some time 10 or any other number.
is there any method to generate only one thread when i play any sound file.
please help me for this.
thanks in advance.
|
|
|
|