- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 12
- Posts with Upvotes
- 10
- Upvoting Members
- 10
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
105 Posted Topics
Re: when I was learning this topic. I followed the very good series of articles on code project, check the below link [quote] [url]http://www.codeproject.com/KB/atl/atl_underthehood_.aspx[/url] [/quote] Hope above helps. | |
Re: I would recommend reading the following thread for detailed explanation on why cin is better to be used in while loop. [url]http://www.parashift.com/c++-faq-lite/input-output.html[/url] [15.2] Why does my program go into an infinite loop when someone enters an invalid input character? another thing if you want to break on the size of … | |
Re: try the below one [code] //HANDLE hPort = CreateFile("COM1", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); HANDLE hPort = CreateFile(TEXT("COM1"), GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); [/code] Hope the above help, you didn't ask what is LPCWSTR ok :). So I am providing the solution only :P. | |
Re: I think J2ME Applications targets wide range of mobiles, while symbian OS has its own (change C++). I will suggests you to use Carbide for symbian development and j2ME ask anyone who knows j2me. I never worked on J2ME. but has enjoyed little development on Carbide :). | |
Re: [quote=darkAngel;321805]as above. [code] string s; cin >> s; [/code] for example, if the user enters Orange, i want it to convert to orange. please advise what i should do. thanks in advance[/quote] Check out this code [code] std::string str; cin>>str; transform(str.begin(), str.end(),str.begin(), tolower ); cout<< str; [/code] | |
Re: Hi, your question is bit unclear... what are you storing in the multimap logically. What I've understood is that you want to get the multiple values against the same key [code=cpp] multimap<int, string> mm; mm.insert(std::make_pair(1, "a")); mm.insert(std::make_pair(1, "c")); mm.insert(std::make_pair(2, "d")); mm.insert(std::make_pair(2, "e")); typedef pair<multimap<int, string>::iterator, multimap<int, string>::iterator> Pair_Range; Pair_Range pRange … | |
Re: search Longest Common Subsequence algorithm. and modify that algorithm to meet your need. | |
Re: Hi, why you've called LoadBitmap(...) in WM_CREATE message? I am sure your problem will be resolved if you change WM_CREATE to WM_INITDIALOG. further you should learn and understand the difference between WM_CREATE & WM_INITDIALOG. | |
Re: sorry PETER_APIIT but your design has several flaws, describe you requirement a bit, then I will tweak your design to meet your needs. | |
Re: bool, true, false are already keyword in C++. you don't need to define enum for it. | |
Re: I think you are trying to acheive the below one. [code=cpp] template<class T> class Foo { typedef void (T::*MFPtr)(int id); MFPtr funcPtr; public: void SetDrawFunction(MFPtr memFunctionPtr) { this->funcPtr = memFunctionPtr; } void Draw(T obj, const int Id) { return (obj.*funcPtr)(Id); } }; class Bar { public: void DoIt(int id) { … | |
Re: I've few questions, [code] FrameVisitor::FrameVisitor() { Frame(); frames = get_frames(myfile); } [/code] you have passed 'myfile' as a parameter in fstream where it is defined? change the following Code. [code] list<Frame> FrameVisitor::get_frames(fstream& myfile) { char * memblock = new char [4]; //1º 4 bytes da frame...header. char * start = … | |
Re: it depends on the compiler rather than C++, you should see the compiler reference manual. | |
Re: Read the following Link Carefully and check for MACRO & GUID that needs to be defined in case of XP, I am assuming that you are good in understanding msdn doc. If you still find it difficult to implement I will provide you the sample. [url]http://msdn.microsoft.com/en-us/library/bb773352(VS.85).aspx[/url] Hope the above link … | |
Re: peek basically reads the next available character without moving the file pointer. for example if text file contains the following text [quote] Hello, World [/quote] and if you execute the following psuedo Code [code=cpp] int main () { // open stream. char v = f.peek(); // the below line will … | |
Re: @firstPerson the default Constructor & Destructor are not always trivial at the Compiler level, to users it might be... Hi lotrsimp12345, This usually irritates the programmer that why the compiler emits a default constructor. Let me explain you a bit detail of how C++ standard dictate about default constructor and … | |
Re: I think you are mixing the pointer to Function with Pointer to member Function, I am giving you a little example on How to solve your problem. [code=cpp] class Foo { public: bool operator()(const int a) { return (a==1); } }; // Don't pass Pointer to Function. typedef bool (*PF)(const … | |
Re: i) create an event and check that event in the child thread ii) signal the event from main thread when you want to exit iii) call UnhookWindowEx() and release resouces in the child thread. psudo code [code=cpp] LONG WINAPI ThreadFunc(LPVOID arg) { HANDLE hEvent = OpenEvent(...,"ChildEvent"); // Perform Coding. // … | |
Re: Serialization & Deserialization technique would help you in acheiving this. or rather use the Boost which will provide you serialization & deserialization by not doing lot of work. check the below link [url]http://www.codeproject.com/KB/cpp/InterprocessSingleton.aspx[/url] | |
| |
Re: if you are using pthread then you can use the following API. [code] int pthread_attr_setschedparam(pthread_attr_t *tattr, const struct sched_param *param); [/code] consult google for such questions :). it will show you more answers. | |
Re: take a look to the following link. [url]http://www.codeproject.com/KB/ISAPI/isapiredirector.aspx?fid=18786&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2967743[/url] | |
Re: First of all for all native Applications written in C/C++ no Framework is required, well as you are using MFC in your project I think you must know the basics of Dll & CRT. In VS2008 create a Win32 Console Application and write a simple hello world program deploy that … | |
Re: I am sure that your BSTreeNode calss must be template class and you should provide the template argument to this as well. like [code] BSTreeNode<DataType, KeyType>* BSTree<DataType, KeyType>::findMin (BSTreeNode<DataType, KeyType>* root) const { // Implimentation ... } [/code]. otherwise provide the implementation of class BSTreeNode to identify the exact error. … | |
Re: [QUOTE=selsium;929931]hi folks, I have some 247 warnigs are same type warning C4996: 'fopen' was declared deprecated I am using makefile to compile my cpp program in Visual studio 2005. I have added _CRT_SECURE_NO_DEPRECATE in preprocessor definition too. but still I do get the warnings . Could anyone help me?[/QUOTE] I … | |
Re: I don't understand your objective behing calling derive funciton in base at all, I understand C++ is multi paradigm language, but I can't see any logical reasoning behind this, could you please elloborate more.. so we can provide you better alternative than this, or correct any mistakes whatsoever | |
Re: Why don't you keep the connection level stuff at the application/module level rather than within the function, so when the game started the delay is bearable. follow anciant dragon's advice and try using the concept of database pooling as well, these together will increase your frame-rate back to the one … | |
Re: Read about OWNER DRAW Window's Style and Windows Subclassing and also Non Client Paint Message. Following Link would help but pre-requisit are the above two concepts. [url]http://www.codeguru.com/cpp/controls/controls/tabcontrols/article.php/c2237[/url] the Below is the link of VB Code just check How API's are being called. [url]http://www.vbaccelerator.com/home/VB/code/Controls/Tab_Controls/MDI_Tabs/article.asp[/url] try this tutorial, if no luck then … | |
Re: try adding the following code in the very beginning. [code] #include <string> using std::string; [/code] this is the solution I can suggest without looking at the .zip file :) Hope this helps. Good luck. | |
Re: I can see problem here. [code] for(int i=0; i<int_totalNumChildren; i++) { genTree->int_transactionID = tranID[i]; // in main int tID = 100; gTree->addChildren(&tID, numOfChildren); } [/code] The problem is clear you have passed the address of local variable tID and you are treating it as an array. what you actually trying … | |
Re: try the following. the syntax seems difficult but look it carefully. [code] (f.*((*it).second))(); (f.*(it->second))(); [/code] the easier way is to create the typedef and assign the return value of m['a'] to that, and then call that pointer to member function. like below. [code] typedef void (A::*FMemPtr)(void); map<char, FMemPtr> m; m['a'] … | |
Re: [QUOTE=petry;908682]Hi All: I have a large number of elements to be stored into vector or basic string(delimited by \n). I need to search for an element and I would like to know what is faster: A:[CODE]std::string str = "\nElement1\nElement2...element1000\n" str.find("\nElement3\n");[/CODE] B: [CODE]std::vector<string> v; v.pushback("Element1"); v.pushback("Element2"); .... std::find(v.begin(), v.end(), "Element3") != … ![]() | |
Re: > start quote: #include<iostream> #include<vector> #include<sstream> #include<algorithm> #include<cmath> #include<string> using namespace std; class ComboLength { public: int howLong(string moves) { vector<int> cc; int i,j,k=0; for(i=0;i<moves.size()-1;++i) { if(moves[i]==moves[i+1]) //Error k++; else cc.push_back(k); } return *max_element(cc.begin(),cc.end()); } }; > I get a segementaion error in line `if (moves[i]==moves[i+1])` > any idea why? … | |
Re: The Below Code might Help just remember MessageBox Returns the Value just store that Value and then Process that response rather than calling the message box again and again. [code=cpp] int nResponse = MessageBox(NULL, TEXT("Hello, World"), TEXT("Say Yes No Cancel"), MB_YESNOCANCEL); if (nResponse == IDYES) { MessageBox(NULL, TEXT("Hey You Pressed … | |
Re: Why you search for the Random Value? is it your requirement? [icode]int a=1 + int (10 * rand() / ( RAND_MAX + 1 ) );[/icode] this would result in a random number, theoratically every time you are creating a new integer to search (i.e. for each loop iteration theoretically a … | |
Re: The Question is where you've Created the Test Folder. Place with your code files. it will identify the header file in that folder then. | |
Re: I think you should look at the below code more carefully and must understand the complexity and map datastructure, if you've any confusion post, I will explain you in more detail then. [code=cpp] fstream inFile("C:\\Laiq.txt"); string line; std::map<string, int> mapWordCount; string word; std::string::size_type endWord; std::string::size_type startWord; while (std::getline (inFile,line)) { … | |
Re: I think you better try WTL/ATL, you might find it interesting. | |
Re: The Below Links would help you. [url]http://www.csharphelp.com/archives/archive281.html[/url] [url]http://bytes.com/groups/net-c/273488-dynamically-create-com-objects-c[/url] | |
Re: [QUOTE=lmastex;750311]Sorry I forgot ( I remember I used them though) Anyways. The problem is that when I make an insertion of an element, I don't want to insert a repeated element, so if I inserted (Age = 20) and then If I insert (Age = 20) my list should have … | |
Re: Anciant Dragon has given the answer of question you've asked, you asked for What is the Execution Sequence you didn't ask How to find out the execution sequence. Let me teach you how to find it out. [code=cpp] void EatSpace(char* Pbuffer) { int i = 0; int j = 0; … | |
Re: Simple replace [code=cpp] for (last = 1 ; last <= first; last++) [/code] with [code=cpp] for (last = first ; last >=1; --last) [/code] replace the above line and every thing is fine. | |
Re: Search for the WinInet MFC Wrrapper, | |
Re: What about Buffer Overflow? :P | |
Re: [QUOTE=JackDurden;748953]How would I delete one char from a string? [CODE]string aWord = "question?"; while(aWord[i]) { if(isalpha(aWord[i]))printf ("character %c is alphabetic\n",aWord[i]); else delete[i]aWord; i++; }[/CODE][/QUOTE] I can give you two ways. one through STL & other through using the strings only [code=cpp] string strWord = "Hello, World!"; string strResult = ""; … | |
Re: By Just Skimming through your Problem statement one can judge its a sorting problem, what you need to do is to analyze which sort will meets your need, if you've small array and planty of space then the following trivial algorithm will meet your requirements. But this trivial algorithm only … | |
Re: Basically using operator new for memory allocation has nothing to do with the smart pointers (auto_ptr or shared_ptr), the purpose of auto_ptr is to encapsulate the naked pointer and release the memory automatically when it exists from scope basically there are several objectives of smart pointers. among those mostly used … | |
Re: PrintCard requires integer parameter and you are not providing one, and the error description shows this as well. Remove this [icode] myBlackjack.PrintCard(); [/icode] with [icode] myBlackjack.PrintCard(10); [/icode] it will print the corresponding card and suit | |
Re: in one line answer is [code=cpp] Loanc operator+(const Loanc & l) const; bool operator<(const Loanc & l)const; bool operator>(const Loanc & l)const; bool operator<=(const Loanc & l)const; bool operator>=(const Loanc & l)const; bool operator!=(const Loanc & l)const; bool operator==(const Loanc & l)const; [/code] make all the above functions global or … |
The End.