|
Hai to all,
i need c++ code for replacing a word with new word in a file
can any one help me
B.Lakshmipathi Rao
|
|
|
|
|
|
Thanks for ur replay
but i need c++ code not MFC
B.LakshmipatiRao
|
|
|
|
|
|
|
I want to change Caption of Dialog from source code .
Someone can help me ?
|
|
|
|
|
::SetWindowText (m_hWnd ,"Anshuman");
|
|
|
|
|
Call
SetWindowText( "Hiiiiiiii" );
in OnInitDialog()
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
in the property window you can set Caption for your dialog
|
|
|
|
|
WhiteSky wrote: in the property window you can set Caption for your dialog
But he wants to change Caption of Dialog from source code
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
see me wrote: n OnInitDialog()
some thing special about OnInitDialog!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
its not problem So SetWindowText(...)
|
|
|
|
|
Hello All,
I have freed the memory which was allocated using malloc.
Is there any utility or function in C to check whether the memory is freed or not.
int *a;
a=(int *)malloc(2*sizeof(int));
a[0]=1;
a[1]=2;
free(a);
Even after free function the value of a[0] and a[1] is same (i.e 1 and 2).
I am using Turbo C. I have doubt whether memory is freed.
Thanks in advance.
|
|
|
|
|
Just because you free memory doesn't mean it doesn't exist anymore. It depends on the OS and the heap. For example, heaps often cache blocks that have just been free to be recycled if a compatible request comes in soon after. Let your heap do its thing and trust in its wisdom.
Steve
|
|
|
|
|
MaHeSG wrote: I have doubt whether memory is freed.
Actually memory is free & goes to OS free mamory heap. But ur pointer still point that memory address. U can read that address. But if u want to write something that exception is generate.
For further conferation allocate same amount of mem after free some mem. OS allocate same mem block for that. A before free if u allocate then provide different mem block.
regards,
Divyang Mithaiwala
System Engineer & Software Developer
|
|
|
|
|
Divyang Mithaiwala wrote: But if u want to write something that exception is generate.
That's not necessarily true. For example, on x86 Windows the CPU, and therefore the OS, can only map memory around in 4K chunks. Another way of saying this is that on Windows (x86) the page size is 4K. This means that if you use a low level memory allocation function (like VirtualAlloc ) the minimum allocation size is 4K. Getting around this limitation is one of the main functions of the heap (whether it's the Win32 heap accessed with functions like HeapAlloc or a custom heap layered over HeapAlloc or implemented in terms of VirualAlloc ). When you attempt a small allocation from a heap (less then 4K on Windows) the heap gets a page of memory (if it hasn't already gone one handy) and hands you part of it. If another small allocation occurs it will hand out another piece of this same page (or some other partially used page) until the whole page is full and then it will get another page and start over. In short, just because you free some memory from a heap doesn’t mean the page that contains that address is freed as other allocations may reside in the same page: only when all allocations on a particular page are freed can the heap release the physical memory (and it may still not do so straight away). The OS can’t efficiently arrange for an exception to be generated when you access the unused part of a page as the underlying hardware only supports setting the memory protection attributes for a whole page. The real situation is even more complex than this brief description: for example the heap can recycle a heap block (and thus not free it) even when it contains no allocations as a form of caching and it need not change the protection on the page (so an exception is generated on access) as doing so means a context switch to Ring-0 and then another back to Ring-3.
|
|
|
|
|
I'm a beginner.I'm working MFC and use Static Control to show texts.But the frame of Static is too small, the texts are so much to show in the frame .
Have everybody anyway to show all texts without change the frame size and Font size ? . I uesed Vertical Scroll Bar but I don't know how to do it.
Please Help me ! thanks
|
|
|
|
|
if you want to show a text without change size and font i suggest use form editbox
|
|
|
|
|
Yes...
As WhiteSky mentioned you can use edit box after disabling for this.
Here you can also find the vertical and horizontal scrol bars
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
The first , I tried with Edit Box , but I want to use Font, colour and Font size . Because i 'm a beginner so I don't known to change Font , colour and Font size in Edit box .
If you know how to , Please show to me ! thanks
|
|
|
|
|
To change font
Here am giving a font of Arial 14 to edit box.
1) add member variable
CFont m_FontArial14;
2) Create font for the edit box in the constructor of the class
m_FontArial14.CreatePointFont( 140, "Arial" );
3) Then call SetFont in OnInitDialog()
GetDlgItem( IDC_EDIT )->SetFont( &m_FontArial14 );
( where IDC_EDIT is the ID of the edit control )
To change color
it is better to override OnCtlColor()
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
for change color see WM_CTLCOLOREDIT or WM_CTLCOLOR for change font you can use m_Edit.SetFont(GetFont())
|
|
|
|
|
Thanhnamdo wrote: I uesed Vertical Scroll Bar but I don't know how to do it.
In static control????
I think u need to change font or frame size of static control to do it.
Dream bigger... Do bigger...Expect smaller
aji
|
|
|
|
|
I found out that _argc is wrong to calculate the count of parameters.
Once there is redirection parameter that looks like '>error.txt'
using redirection symbol '>'
the _argc is wrong, why?
|
|
|
|
|