|
mmagill0 wrote: I have edited the registry and set it as default, but when I double click the file it runs the program with nothing there...
Did you put %1 in your registry string?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi!
I've to insert a value to a column in a particular data base tabel on a Button Click Event. I write the following statement to execute this:
SQLdb.Query("INSERT INTO Current(TeamID) values('countryId')");
countryId is an int value. I've printed and verified it. But when the click event happens and if I open the database and check for the corresponding column, only "countryId" is present(variable's name not the variable value as I expect). If I give countryId without single quotes in the statement also the result is the same. What to do to store the variable's value in to the database?
|
|
|
|
|
You need to first format the string before calling the function.
CString cs;
cs.Format(_T("INSERT INTO Current(TeamID) values(%d)"), countryId); Now you can pass cs into the function.
|
|
|
|
|
Hi!
CString is MFC class. I can't use MFC for this project. Can I use Format()
for std::string s also? Can you please tell me the difference between Format()
for MFC and Format() for std::string if any?
|
|
|
|
|
CString is a common class for MFC and ATL.
You can use it by including atlstr.h .
There is no Format for std::string .
You will either have to use boost::format or sprintf .
char query[512];
sprintf_s(query, 512, "INSERT INTO Current(TeamID) values(%d)", countryId);
|
|
|
|
|
Or you can also use a std:stringstream to format the string properly. Check this article[^] for more info.
|
|
|
|
|
Hi all,
i m using access database,with ODBC Connection,and i m using CRecordset class here.
i want to insert the image file in Access database please tell me how can i do this.
thanks in advance.
|
|
|
|
|
(Could not find a more appropriate location for this question.)
We are looking to use WiX as our installer creator as it is so powerful, and not that hard to learn/use. But, it does not automatically find dependencies, whereas the VS installer automatically adds in standard merge modules. Is there any tool we can use to locate dependent merge modules such as Microsoft.VC80.MFC ?
|
|
|
|
|
You can use the Dependency Walker, which is provided with Visual Studio. To run it open a Visual Studio Command Prompt and execute depends.exe : the Dependency Walker lets you open an executable file and give you informations about dependencies and imported and exported symbols.
|
|
|
|
|
Thank you. Unfortunately it only tells us the DLLs. What we really would like to know is the merge modules. We can of course go through the DLLs, and locate the matching merge modules, but that is fairly time consuming.
|
|
|
|
|
|
Use the pow function defined in math.h .
|
|
|
|
|
Unfortunately he cannot use pow(2, 12345) , because the result is bigger than the maximum number that a float and double can hold.
Anyway, when I see question like this one, I think that the enquirer is interested in big integer arithmetic required for some cryptographic ciphers (like RSA).
Have a look to this links, I think it could be helpfuf:
bigint c++ Google search[^]
|
|
|
|
|
Big integers?? I 2^12345 is (in binary) 1 followed by 12345 zeroes (1544 bytes!)... And probably that's just the answer.
If he have to estimate the value, 2^12345 is 10^(12235/Log10(2)) =
10^3716.
If the ^ is instead the XOR operator ... the result is 12347 (divide by 2, add one if even o subtract one if odd, and multiply by 2)
2 bugs found.
> recompile ...
65534 bugs found.
|
|
|
|
|
You are right! 2^12345 is simply 1 followed by 12345 zeroes and it is equal to 10^(12345/Log10(2))
I spoke about big integer libraries because I think that the enquirer is asking about "how to keep in memory numbers with this kind of size, and how to make calculations with them"...
|
|
|
|
|
How to control the size of the text file that we want to write in and create another file if it passes our limit in vc++??
i.e: Assume that we put the incoming messages to a logfile.txt, as soon as its size got bigger than 10mb, we must create another file, name logfile(2).txt and continue writing on this.. this goes like this...
|
|
|
|
|
Get the size of the file when opening the file.
Keep adding the size of data being written.
When the size exceeds the limit open another file and reset the size variable to 0.
|
|
|
|
|
If you mean: how to know the size, you can either simply have a counter which you increase by the length of the text written to the file each time and then after of before writing the text check it if it exceeds your limit and then close the current file and create the new one. Or you can use ftell[^] or SetFilePointer[^] (or somesuch, depending on how you handle the file) to query the file pointer and if it is above a certain position, again, close the current file and open a new one.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
With GetFileSize()[^] you can get the size of a specified file (on Windows) and with some program logic around you will be able to write to multiple log files.
Hope this helps
|
|
|
|
|
please check size of file before write the data in to file and if data is greater than your limit of size then create another file.
|
|
|
|
|
Dear All,
Very Good morning.
I am facing some conceptual doubts in post increament and pre increament operators in for loop.
Kindly follow the code below:
for(int i=0;i<5;i++)
{
cout<<i<<endl;
}
output:
0
1
2
3
4
again,
for(int="" j="0;j<5;++j)
{
cout<<j<<endl;
}
Output" will="" be="" same.
my="" question="" is="" how="" the="" processing="" of="" code="" takes="" place?
++j="" &="" i++="" both="" are="" possessing="" same="" output,="" how?
<div="" class="signature">French is the language of love, for everything else there is c++ ...(anonymous)
|
|
|
|
|
For a built in type and not using the result of the expression ++n ; and n++; do the same thing. The only time there are any differences in behaviour are when the operators are used in more complicated expressions e.g.:
a = ++n;
and
a = n++;
For classes the situation is a bit different. It's up the class implementer to decide on the semantics of the operators - generally though you'd be asking for mockery to do something too off the wall and different from what built in types do.
Cheers,
Ash
|
|
|
|
|
I saw the same question from you in Q&A. Please, don't post the same question to multiple forums.
|
|
|
|
|
I agree with Sauro. If I'd seen the question here before I went to the effort of answering it in QA, I wouldn't have taken the trouble.
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I have an CListCtrl object on an CFormView and on button click I want to rezise CListCtrl object ... here is my trial code :
void CTestView::OnButton1()
{
CRect Rect;
m_List1.GetWindowRect(Rect);
Rect.DeflateRect(Rect.left,Rect.top - 10,Rect.right,Rect.bottom);
m_List1.MoveWindow(Rect);
}
I want to short to 10 m_List1 less tall but keep bottom position ... but , when I clicked button , m_List1 disappear ... what I am doing wrong ?
I try in another way but with the same result :
void CTestView::OnButton1()
{
CRect Rect;
m_List1.GetWindowRect(Rect);
Rect.DeflateRect(Rect.left,Rect.top - 10,Rect.right,Rect.bottom);
m_List1.SetWindowPos(GetParent(),Rect.top - 10,Rect.left,Rect.Width(),Rect.Height() - 10,SWP_NOZORDER);
}
Can anybody help me ? Thank you.
|
|
|
|