|
bonkers123 wrote: You mind sharing the bits and pieces you do know?
A lot of folks erroneously use Task Manager to determine if their code is "leaking" memory.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I know that's one of the biggest mistakes a person can make...
Anyway... problem seems to be sorted. Tnx, I Geuss....
|
|
|
|
|
Hi,
I have a two part question, can be written in either C++ or C#
1. How to figure out which versions of VC++ runtime installed on the computer?
2. How do I write a bootsrap program that checks if Visual C++ 2008 Libraries installed or not and then goes and install Visual C++ 2008 Redistributable Package if not installed?
Thanks
Ben
|
|
|
|
|
ben2 wrote: 1. How to figure out which versions of VC++ runtime installed on the computer?
It well built in with VC++ redistributable package!, if the VC++ redistributable is installed on the computer, then installer will do nothing!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
I searched the forum for this specific question and can't find it so here it is.
I ran into this "extern inline" syntax in several U-boot C header files. I know the idea about putting extern is to avoid the multiple definition, but the confusing part is the inline part.
What happens in my compiler is this... it takes the extern, but not the inline. So during linking, it's looking for that function, and can't find it.
Now I normally use inline keyword for C++ header files that is protected by include guard, so the extern is not really useful (especially inlined functions already have definition there).
My question is, can someone explain in layman's term how this "extern inline" supposed to work?
They seem to be mutually exclusive to me: "extern" keyword means "it's defined somewhere else" and inline means "replace your code with this definition".
So I believe my compiler is behaving correctly...
Yes, I know I can google into this, but I'm just too lazy to think now
Thanks!
|
|
|
|
|
If the function can be inlined it will be, otherwise it will attempt to link to the function. This means it must exist in source somewhere. One thing to check is if a macro is used to define "extern inline" and can be turned on/off easily.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
my application is dialog based MFC appln. VC 6.0
please help me ASAP.
Thanks
RAM
|
|
|
|
|
Have you considered CDC::SetBkColor() ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi
I am looking for C program source code. Could you please help me in finding the source code of the required mentioned below.
Task that I need to complete:
Write a program to create multiple threads (one master thread and rest worker threads) and using the threads write into and read from shared memory.
Restrictions:
Only one thread should be able to read at any instant of time into shared memory region.
Only one thread should be able to write at any instant of time into shared memory region.
Worker threads should inform the master thread after every read and write operation.
Master thread inform the worker thread (which is waiting to acquire shared memory region) that read or write operation is successful and it can acquire the memory for either reading and writing operations.
|
|
|
|
|
You can use a mutex to limit access to shared memory to only one thread. You'll have to write the code yourself; that's the point of taking a class.
|
|
|
|
|
Subhankar wrote: Could you please help me in finding the source code...
Isn't the main purpose of your class to create the code rather than find it?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
What an excellent question! This is a LOT more clearerer than Globule Beats Brick! Here you go, you can write the void main() function:
char data[360];
class rthread {
char* myDataPtr;
rthread(char* ptr){
myDataPtr=ptr;
}
bool write(char* d,int size){
return memcpy(d,myDataPtr,(size>360?359:size));
}
}
class wthread {
char* myDataPtr;
wthread(char* ptr){
myDataPtr=ptr;
}
bool read(char* d, int size){
return memcpy(myDataPtr,d,(size>360?359:size));
}
}
class mthread {
char* myDataPtr;
wthread* myWriter;
rthread* myReader;
mthread(char* ptr){
myDataPtr = ptr;
wthread = new wthread(myDataPtr);
rthread = new rthread(myDataPtr);
}
~mthread(){
delete wthread;
delete rthread;
}
bool read(char* c,int size){
return myReader->read(c,size);
}
bool write(char* c,int size){
return myWriter->write(c,size);
}
}
|
|
|
|
|
I am a beginner and I really don't have any idea about C++. I really in need of C code.
|
|
|
|
|
Hi all,
So, I have an MFC app to encode files in base64 to be sent through email. Here's the code I'm using now :
filename=filename.Right(filename.GetLength()-filename.ReverseFind('\\')-1);
inputfile.Read(filedata.GetBuffer(0),inputfile.GetLength());
filedata.SetAt(inputfile.GetLength(),'\0');
emailbody+="--0000000002230291k492__V\r\nContent-type: "+fileExt+"\r\n";
emailbody+="Content-Transfer-Encoding: base64\r\nContent-Disposition: attachment; ";
emailbody+="filename=\""+filename+"\"\r\n\r\n";
emailbody+=base64_encode(filedata.GetBuffer(0)).c_str();
emailbody+="\r\n\r\n";
inputfile.Close();
I've got no clue of why this code doesn't work properly. It works fine for .txt files and other files that only contain alphanumeric chars, ONLY WHEN the files are smaller than around 5kb. Other files do not work at all, regardless of the size.
here's the base64 encode function I'm using:
inline std::string base64_encode(const std::string &sString) {
static const std::string sBase64Table(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
);
static const char cFillChar = '=';
std::string::size_type nLength = sString.length();
std::string sResult;
sResult.reserve(nLength * 8 / 6 + 1);
for(std::string::size_type nPos = 0; nPos < nLength; nPos++) {
char cCode;
cCode = (sString[nPos] >> 2) & 0x3f;
sResult.append(1, sBase64Table[cCode]);
cCode = (sString[nPos] << 4) & 0x3f;
if(++nPos < nLength)
cCode |= (sString[nPos] >> 4) & 0x0f;
sResult.append(1, sBase64Table[cCode]);
if(nPos < nLength) {
cCode = (sString[nPos] << 2) & 0x3f;
if(++nPos < nLength)
cCode |= (sString[nPos] >> 6) & 0x03;
sResult.append(1, sBase64Table[cCode]);
} else {
++nPos;
sResult.append(1, cFillChar);
}
if(nPos < nLength) {
cCode = sString[nPos] & 0x3f;
sResult.append(1, sBase64Table[cCode]);
} else {
sResult.append(1, cFillChar);
}
}
return sResult;
}
This function seems to be encoding correctly, while other ones I've found or created don't encode right.
Does anyone have any advice for me? I'm about to give up on this function.
|
|
|
|
|
If you can accept being limited to XP and later, use CryptBinaryToString() .
|
|
|
|
|
How do I change the shadow color in ShadowVolume(DirectX Sample Browser November 2007,July 2004)?
I want to change the color of shadow to be float4(0.7f,0.7f,0.7f,1.0f).
I mean the shadow color is not the g_vShadowColor for debug.
|
|
|
|
|
For example:
In CMyDocument:
std::vector<pair><float,float> m_vec;</pair>
CMyDocument::Serialize(CArchive &ar)
{
if (ar.IsStoring())
{
}
else
{
}
}
modified on Tuesday, June 17, 2008 11:40 AM
|
|
|
|
|
On storing : first store vector size and then each (scalar) element of the vector.
On reading: read the size of the vector, then its size elements.
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
|
|
|
|
|
I tried following code but it working for Progess bar not for Static text.
GetDlgItem(IDC_PROGRESS1)->ShowWindow(SW_SHOW); // Working
GetDlgItem(IDC_STATIC)->ShowWindow(SW_SHOW); // Not working
Kindly provide me solution...
|
|
|
|
|
IDC_STATIC as is won't work. you have to chage it to another name, like IDC_STATIC1 ...
|
|
|
|
|
The IDC_STATIC is default resource id provided for controls which are usually not accessed and manipulated. For instance, static texts, GroupBox etc. If you check the value of IDC_STATIC , you can see its -1 .
So, if you want to manipulate that text control, as toxcct said, change the IDC_STATIC to some other name and access it. Or else GetDlgItem() will fail.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
can you tell me how to change the bback ground of label.
Please reply me.
Thanks
Ram
|
|
|
|
|
Are you referring to the background color?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
ramnathrn wrote: can you tell me how to change the bback ground of label.
I guess you've asked "how to change the background color of label".
Well, override the CWnd::OnCtlColor() in your dialog class. This function will be called for getting the control color of each child control. See here for more detailed description and code sample - http://msdn.microsoft.com/en-us/library/0wwk06hc(VS.80).aspx[^]
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|