|
ok thanks a lot.do you know how to do it in linux(fedora?)
|
|
|
|
|
#include<iostream>
#include<csetjmp>
#include<stdexcept>
using namespace std;
int main(){
int a=0;
int b;
try{
if(a==0)
throw "Denominator should not be zero"
b=12/a;
}
catch (const char msg[])
{
MessageBox(msg,"Exception",MB_OK | MB_ICONEXCLAMATION);
}
catch(...){
cout<<"an exception acurred :"<<;endl;
b=12;
}
}
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
I have outlook add-in developed using ATL C++. It has 2 button in outlook standard toolbar.
it will work in all versions of outlook (outlook 2000 onwards) fine. After clicking new mail (another window will appear) there buttons not appearing. please tell the way how to add a button for that window.
|
|
|
|
|
Hi,
I have an hdf (extension )file , i need to read that file and convert it into an ASCII format using C program.
The problem is small but not finding a way.
Thanks
|
|
|
|
|
You have to describe HDF file format
|
|
|
|
|
Does this page[^] help at all?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
|
Very thanks for your reply....
Only documentation is not helpful,
I need a way to read that particular file in a format it is written to convert it to text.
Thanks
|
|
|
|
|
Hi Friends,
Iam new to VC++, i have 2 dialogs with me ... every time i run it Dialog 1 is opening. I want to run Dialog 2 as a startuo dialog.. where i have to change the code... Please help me...
|
|
|
|
|
Look in your WinMain procedure where it calls the dialog, and change the reference as required.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I have a CTreeViewCtrl, it has 2 item, "Item1", "Item2", when I move mouse to "Item1", show tip message "this is Item1", when I move mosue to "Item2", show tip message "this is Item2", how can I realize this with WTL, thanks a lot.
|
|
|
|
|
If your tree control has TVS_INFOTIP style it will send it's parent the TVN_GETINFOTIP [^] notification.
Handle it in the parent message map with the
NOTIFY_CODE_HANDLER(TVN_GETINFOTIP, OnGetInfoTip) macro and a matching
LRESULT OnGetInfoTip(int , LPNMHDR pnmh, BOOL& )
{
LPNMTVGETINFOTIP pgit = (LPNMTVGETINFOTIP)pnmh;
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
I got it,thank you very much
|
|
|
|
|
shg104 wrote: I got it,thank you very much
Then please upvote the answer
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Hi,
At my workplace we have a number of programs (sub systems) which make up our software. Some of these programs need functionality from other programs and I'm trying to find a good way to perhaps modularize each program so that common code/resources can be used "globally". The current example forcing me to find a solution is the need to launch a dialog from our Accounting package from another sub system. The big problem is that this is quite a large dialog and depends a lot on things from the Accountings MainFrame.
I was thinking that for each sub system I could create a DLL which contained common dialogs, etc that could be used by other programs. The problem I face is that a lot of the dialogs have dependencies on their parent programs MainFrame and I'm not sure how to get around it. I guess one solution might be to take everything out of the MainFrame and put it into its own class which can then be passed to the DLL.. but I don't even know if that would work as I still need to Initialise this new class the same way it would be done in the parents program, but now in the other sub system.. though in saying that the DLL should probably be responsible for setting itself up.
Your thoughts?
Cheers
|
|
|
|
|
I do not know whether or not this has anything to do with "ATL / WTL / STL", as it seems purely a question of "Design & Architecture". I would suggest posting it in the latter forum.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
First of all, you have posted your question in a wrong section.
Secondly, what I understood is, you need a compact solution.
Lets assume you have A,B,C these three Sub programs having dependency on X,Y,Z systems. Now again you said, you have a main prog., say ProgMain, which then have a total control over A,B & C. Am I right?
If this is a kind of situation, then I would rather prefer to use MFC/MDI with multi threaded arcitecture. Rather using DLL, I would suggests you to use Class files of A,B,C.
I can give you better suggestion, if you can explain the situation with a good example.
|
|
|
|
|
I'll try explain it again as I'm not sure if your suggestion is applicable.
There is a program called MainMenu which is basically the launching point for all the other sub systems like Accounting, Address Book, etc. There is now a need to be able to launch a dialog in Address Book that is in Accounting. Eg. for a person in the address book we might like to add a bank account to them so we want to the launch the "Add Account" dialog contained in the Accounting program.
I can see two ways of doing this.
1. Putting common dialogs/code from each sub program into its own DLL so it can be used in other programs
2. Sending a message to main menu which then opens Accounting if its not open already, and then opens the required dialog then messages the result back.
Option one I'm not entirely sure if it a good solution and option two would work but it would require a custom messaging system to be able to make it scalable I think.
Are there other options out there that help with this sort of Inter-Program-Communication/Modularizing problem?
|
|
|
|
|
Hi All,
I want to create a map of CList items. I tried the following.
CList<int> li;
CMap <CString, LPCTSTR, CList<int>, CList<int>> testMap;
VS2008 throws error
Error 6 error C2248: 'CObject::operator =' : cannot access private member declared in class 'CObject' c:\program files\microsoft visual studio 9.0\vc\atlmfc\include\afxtempl.h 776 TestUG
Can anyone help me with creating a map with a list.
Thanks
kasi
|
|
|
|
|
I do not know whether or not this has anything to do with "ATL / WTL / STL", as it seems purely a question of "C / C++ / MFC". I would suggest posting it in the latter forum.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
i think this is because of lack of overloaded assignment operator in CList class. Try delcaring your map as
CMap <CString, LPCTSTR, CList<int>, CList<int>& > testMap;
|
|
|
|
|
I have a vector of strings which I want to search for a particular string.
I am using:
vector<string>::iterator it = find( vecStrings.begin(), vecStrings.end(), sMax );
sMax is a std::string
When I compile this (and it is specifically this line causing the problem) I get the following:
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::vector<_Ty,_A> &,const class std::vector<_Ty,_A> &)' : could not deduce template argument for 'const class std::vector
<_Ty,_A> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::allocator<_Ty> &,const class std::allocator<_U> &)' : could not deduce template argument for 'const class std::allocat
or<_Ty> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::istream_iterator<_U,_E,_Tr> &,const class std::istream_iterator<_U,_E,_Tr> &)' : could not deduce template argument fo
r 'const class std::istream_iterator<_U,_E,_Tr> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::reverse_bidirectional_iterator<_BI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_bidirectional_iterator<_BI,_Ty,_Rt,_Pt,_
D> &)' : could not deduce template argument for 'const class std::reverse_bidirectional_iterator<_BI,_Ty,_Rt,_Pt,_D> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::istreambuf_iterator<_E,_Tr> &,const class std::istreambuf_iterator<_E,_Tr> &)' : could not deduce template argument fo
r 'const class std::istreambuf_iterator<_E,_Tr> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &,const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &)' : could not deduce te
mplate argument for 'const class std::reverse_iterator<_RI,_Ty,_Rt,_Pt,_D> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const struct std::pair<_T1,_T2> &,const struct std::pair<_T1,_T2> &)' : could not deduce template argument for 'const struct std::pair<
_T1,_T2> &' from 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2676: binary '==' : 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' does not define this operator or a conversion to a type accept
able to the predefined operator
C:\test\test.cpp(6846) : see reference to function template instantiation 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *__cdecl std::find(class std::basic_string<char,struct std::char_trai
ts<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,const class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)' being compiled
Any ideas?
|
|
|
|
|
Hi,
Your compiler's first message is explanative:
Jonnster wrote: I get the following:
c:\program files\microsoft visual studio\vc98\include\algorithm(43) : error C2784: 'bool __cdecl std::operator ==(const class std::vector<_Ty,_A> &,const class std::vector<_Ty,_A> &)' : could not deduce template argument for 'const class std::vector
Make it happy with:
std::vector<std::string>::iterator it = std::find(vecStrings.begin(), vecStrings.end(), sMax); With C++0x (VS2010 or gcc 4.5) you can write:
auto it = std::find(vs.begin(), vs.end(), sMax); which instructs the compiler to deduce the type of it .
With previous compilers use typedef to get simpler code:
typedef std::vector<std::string> VS;
VS vs;
VS::iterator it = std::find(vs.begin(), vs.end(), sMax);
cheers,
AR
C++0x wording edited
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
modified on Friday, October 22, 2010 4:24 AM
|
|
|
|
|
Hi All,
I want to declare memory dynamically for a 2 dimensional array.
and then want to use that pointer like an array.
as i am using ANSI compiler so there is no need to typecast the return type of the memory block returned by malloc()
so if i will write the inline code line as arr=malloc (nrows*5*sizeof(int)); its working correctly but i just want to know to be at the safer side that if i will be using the old compiler how to type cast the same as arr=(int [] *)(malloc (nrows*5*sizeof(int))); this is giving error.(i am on linux)
thanks
#include<stdio.h>
#include<stdlib.h>
int main()
{
int nrows=2,i,j;
int (*arr)[5];
<code>arr=(int [] *)(malloc (nrows*5*sizeof(int)));</code>
for(i=0;i<nrows;i++)
for (j=0;j<5;j++)
arr[i][j]=17;
for(i=0;i<nrows;i++)
for (j=0;j<5;j++)
printf("\n%d",arr[i][j]);
}
|
|
|
|
|
Try this:
arr=(int (*)[5])malloc (nrows*5*sizeof(int));
Alternatively (and this is clearer overall) use a typedef:
typedef int (*ArrType)[5];
int main()
{
ArrType arr;
arr=(ArrType)malloc (nrows*5*sizeof(int));
... Rest of code ...
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|