1,174 Posted Topics
Re: [QUOTE=bpacheco1227;652832]Any guidance on how to polish this code up would be greatly appreciated. [/QUOTE] The code needs proper, consistent indentation. | |
Re: [QUOTE=dipumali;659212]hi i am dipali i am trying to store multiple objects in file but it will store only one object with the help of read & write function plz tell me solution.[/QUOTE] Maybe you open the file so that it gets truncated every time, i.e. the [I]mode[/I] parameter is wrong? … | |
Re: You need to change e.g. [ICODE]if(Addition = true)[/ICODE] to [ICODE]if(Addition == true)[/ICODE] | |
Re: Try replacing the line [ICODE]PaintRoutine(hwnddc, GetPixel(hDC, pt.x + x, pt.y + y), 1, 1, 1 + x, 1 + y);[/ICODE] with [ICODE]SetPixel(hwnddc, x, y, GetPixel(hDC, pt.x + x, pt.y + y));[/ICODE] | |
Re: How about managing the [ICODE]id[/ICODE] in the [ICODE]Base[/ICODE] class, i.e. [code] class Base { public: explicit Base() : id(object_count++) {} static int object_count; protected: int id; }; int Base::object_count = 0; class child: public Base { public: child(int val){} }; int main() { child c(1); return 0; } [/code] | |
Re: [code] ... double CelsiusToFahrenheit(double c); ... int main() { ... } double CelsiusToFahrenheit(double c) [COLOR="Red"];[/COLOR] // <- remove the semicolon { return (9.0 / 5.0 * c + 32); }[/CODE] | |
Re: [QUOTE=ThomsonGB;654437] Linking... sub_proc.obj : error LNK2019: unresolved external symbol __imp__InitializeSecurityDescriptor@8 referenced in function _process_init [/QUOTE] You need to link with Advapi32.lib. | |
Re: [QUOTE=manzoor;655049]I meant the project in the link How would you compile that ?[/QUOTE] That project uses MFC which is not included in the Express Editions, meaning that you cannot compile it. | |
Re: You might use stringstream ... [code] #include <vector> #include <string> #include <sstream> using namespace std; int main() { int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; int f = 6; vector<string> abcd; stringstream sstrm; sstrm << a << … | |
Re: A radical suggestion, instead of coding the games inside the switch, make the games functions and do something like [code=cplusplus] while(1) { cout << "A: To Play the number guessing game." << endl; cout << "B: To Play the letter game." << endl; cout << "C: To quit program." << … | |
Re: [ICODE]#include <winresrc.h>[/ICODE] in the .rc file, that way the definitions of e.g. [ICODE]DS_MODALFRAME[/ICODE] and [ICODE]WS_POPUP[/ICODE] will be known. In addition to that, add [ICODE]#define IDC_STATIC -1[/ICODE] in the resource.h file. | |
Re: [QUOTE=mansangeet;654429]need help in php coding !!!!!!!!!!!!!!! not able to send values to database................. hav checked the code many times............ when i apply conditions in my code ...it simply stops sending values to database... plz help.........[/QUOTE] This is a C++ forum, but [URL="http://www.daniweb.com/forums/forum17.html"]here[/URL] is a dedicated forum for PHP. Try posting … | |
Re: The [ICODE]InitDocStruct()[/ICODE] function seems OK to me. So the problem probably is in the actual printing code you have. | |
Re: [QUOTE=11silversurfer1;652120]sorry that doesn't work. I am trying to draw a line from where my mouse is when i click to where it is when i let go, if that helps. if i do it at 0,0 its fine but as i go further across and down the line isn't where … | |
Re: [QUOTE=raja289;653203]just shows last student records ten time instead of each student . [/QUOTE] Isn't that quite obvious if you take a close look at the loop, [code] for(k=1;k<=10;k++) { // do this ten times ... // ask the user for the file name <-> [COLOR="Red"]shouldn't you[/COLOR] // [COLOR="Red"]open the file … | |
Re: [CODE] #include<iostream> using namespace std; [COLOR="Red"]int main() [/COLOR]// <- This line simply just MUST // NOT be here .. there is no way around it [/code] | |
Re: [QUOTE=ninjaneer;653451]by that I mean I added the DLL's path to the additional dependencies directory...?[/QUOTE] PATH does not mean the 'additional dependencies directory'. Windows searches for the .dll at run-time as specified in [URL="http://msdn.microsoft.com/en-us/library/ms682586.aspx"]Dynamic-Link Library Search Order[/URL] PS. You can check your PATH environment variable simply by typing [ICODE]PATH[/ICODE] in a … | |
Re: [QUOTE=Wiki_Tiki;653541] 'This is a test'. When you save it and then open it in notepad, this is what it looks like: {\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}} \viewkind4\uc1\pard\fs20 this is a test\par } see? a whole lot of crap is added to the text file. How can I fix this? [/QUOTE] The content is … | |
Re: First of all, please use [I]code tags[/I] when you post your code. You have an extra curly brace there ... [code] [COLOR="Red"]// }[/COLOR] <- extra curly brace here ~Quadrilateral() // Call Destructor { cout << "\n\nThe Base Class Rectangle has been destroyed!" << endl; }; [/code] [EDIT] Oh well, niek_e … | |
Re: I think the library you need is [I]libcomdlg32.a[/I]. Generally, when you get linker errors related to Windows API functions, lookup the function's documentation in MSDN, scroll down to the bottom of page where you can find the name of the required .lib (i.e. in this case: [I]Import library Comdlg32.lib[/I]). That … | |
Re: Shouldn't you be using [ICODE]pi2->pDevMode->dmFields = [B]DM_ORIENTATION[/B];[/ICODE] instead of [ICODE]pi2->pDevMode->dmFields = DM_PAPERSIZE;[/ICODE] | |
Re: [QUOTE=karang;652311]But I am getting linker error. " [Linker error] undefined reference to `OpenPrinterA@12' " [/QUOTE] You (may) need to [ICODE]#include <winspool.h>[/ICODE] If you are not using a MS compiler, you need to link with libwinspool.a, otherwise winspool.lib. | |
Re: [QUOTE=Evan M;650998] Apparently, calling TTF_Quit before TTF_CloseFont will cause the error. Is there any easy way around this?[/QUOTE] You might also consider using [URL="http://www.cplusplus.com/reference/clibrary/cstdlib/atexit.html"]atexit()[/URL] | |
Re: You might use debug version of the Wininet.dll, it is available at [URL="http://www.microsoft.com/downloads/thankyou.aspx?familyId=57ad7099-de71-4b1c-8147-725545454146&displayLang=en"]http://www.microsoft.com/downloads/thankyou.aspx?familyId=57ad7099-de71-4b1c-8147-725545454146&displayLang=en[/URL] | |
Re: Obviously you don't have a class named [ICODE]CMyView[/ICODE], so you cannot use the provided example as is. Instead you could e.g. make the provided example a stand-alone function and use it as such, i.e. simply [code] BOOL GetPageSize(CSize &nRetVal) { // rest of the example code here ... } [/code] | |
Re: [QUOTE=henpecked1;649277]error C2511: 'Contributor::Contributor(std::string,double,Contributor::gender,int)' : overloaded member function not found in 'Contributor' see declaration of 'Contributor'[/QUOTE] In the class declaration, you probably meant to have [I]a member variable[/I] like [ICODE]gender Sex;[/ICODE] instead of [ICODE]enum gender;[/ICODE] | |
Re: The function is [ICODE]malloc()[/ICODE], not maloc(). | |
Re: Please, use [URL="http://www.daniweb.com/forums/misc-explaincode.html"]code tags[/URL] when you post code. See the comments ... [code] double getdaysmissedavg(int num_employees, int days_missed) { int numemployees=0; int daysmissed=0; double daysmissedavg=0; // every time you call this function, you effectively calculate // '0/0' which results in error (you must not divide by zero) // shouldn't you … | |
Re: [QUOTE=Prabakar;648197]I have read about Object Serialization in my JAVA book. Could it be possible with C++?[/QUOTE] See e.g. [URL="http://www.parashift.com/c++-faq-lite/serialization.html"]here[/URL] | |
Re: [QUOTE=pdk123;646490]how do i use it ?[/QUOTE] [URL="http://www.daniweb.com/forums/misc-explaincode.html"]see here[/URL] | |
Re: Do you really have the following line as is in the code? [ICODE]} log.h (a header file)[/ICODE] If you do, then there's the error. | |
Re: [QUOTE=camproject;647772]I have written the below code to create a modaless dialog.what to do to view the dialog?it just blinks and goes away... [code]combodlg cd= new combodlg(this); cd.Create(IDD_DIALOG1, this); cd.ShowWindow(SW_SHOW);[/code][/QUOTE] The constructor of the dialog can be like [code] combodlg::combodlg(CWnd* pParent /*=NULL*/) { VERIFY(Create(IDD_DIALOG1, pParent)); } [/code] and to use the … | |
Re: [QUOTE=CoolGamer48;647408]I'm pretty sure that exists too. I also love this one (not sure if its in Windows API or DirectX): [CODE=C++] #define 1 TRUE #define 0 FALSE [/CODE] [/QUOTE] Actually it would be [code] #define TRUE 1 #define FALSE 0 [/code] | |
Re: [QUOTE=camproject;647197]i have to add only one line at a time.what i need is add he item in second dialog to first dialog's combo box as soon as I hit "Add" button each time.[/QUOTE] You might change the second dialog's constructor to take e.g. a pointer to the first dialog's CComboBox … | |
Re: [QUOTE=mikesharp;645469]I compiled it and ran it as an exe file :( sorry this is not my area,[/QUOTE] Say your .html file's full path is: "d:\folder\file.html", then the following command should do [code] // open the .html in default browser system("start file://d:/folder/file.html"); [/code] | |
![]() | Re: Generally you use the [URL="http://msdn.microsoft.com/en-us/library/ms648029(VS.85).aspx"]MAKEINTRESOURCE[/URL] macro to convert the resource id. However, the [ICODE]createStream()[/ICODE] probably isn't capable of playing a resource. |
Re: [QUOTE=13L4D3;646397]if possible cud u provide me with some links.[/QUOTE] [URL="http://www.learncpp.com/cpp-tutorial/136-basic-file-io/"]Basic file I/O[/URL] Googled [URL="http://www.google.com/search?q=odbc+c%2B%2B+wrapper&ie=utf-8&oe=utf-8&aq=t"]odbc c++ wrapper[/URL] | |
Re: [QUOTE=Shadoninja;645876]Is there a command that hides the dos window while the program executes??[/QUOTE] You might be looking for something like this [url]http://www.codeproject.com/KB/winsdk/runsilent.aspx[/url] | |
Re: You might want to set the [ICODE]HideSelection[/ICODE] property of the [ICODE]RichTextBox[/ICODE] to false. | |
Re: You have an extra semicolon in couple of places, e.g. [code] // the following effectively first reads all the available input and only after that advances further ... while(fin>>aemployeename>>apaystat>>ahoursworked>>ahourlyrate)[COLOR="Red"];[/COLOR]{ [/code] If you would have a do/while construct, then you'd need the semicolon, i.e. [code] do { // something } while(something) … | |
Re: You might try something like the following, it removes all spaces that precede an '>'. [code] const std::string srch = " >"; std::string::size_type pos; while(std::string::npos != (pos = Line123.find(srch))) { Line123.erase(pos, 1); } [/code] | |
Re: [QUOTE=tootypegs;644002]I would also like its modified time and date.[/QUOTE] See e.g. [URL="http://msdn.microsoft.com/en-us/library/ms724902(VS.85).aspx"]RegQueryInfoKey()[/URL] | |
Re: [QUOTE=CoolGamer48;643648] ... The exception to this rule is when the member is static and integral.[/QUOTE] The exception to this rule is when the member is static and integral and [I][COLOR="Red"]const[/COLOR][/I]. | |
Re: [QUOTE=Jennifer84;643748] I dont know why this is happening and what could be done about that. [code] form2->TopMost::set(true); [/code][/QUOTE] It is happening because that is what the above line does. Maybe you could instead try to use the Form2's Owner property, i.e. [code] Form2 ^form2 = gcnew Form2; // Form1 owns … | |
Re: Are you sure about the input file's name ?? [code] fin.open("readLab5.[COLOR="Red"]cpp[/COLOR]"); [/code] You almost got the code tags right, however next time you might want to utilize the "Preview Post" button to make sure that the code tags really are right. | |
Re: The prototype and the definition mismatch .. [CODE] int ConvertANSI(char sChar [COLOR="Red"][][/COLOR] ); int ConvertANSI(char szText [] ) { return static_cast<int>(szText[0]); }[/CODE] | |
Re: [QUOTE=camproject;642594]i want to delete a particular row from the file.i have three values written in the single line. i have to select a value from a combo box where one of the values was written at the time of writing it to the file.how could i accomplish this?ie,how could i … | |
Re: You have obviously gotten confused about the syntax of returning a value in VB, e.g. Instead of doing [code] GetRandomNumberInRange = szS + Lower; [/code] you should [I]return[/I] the resulting value at that point. And change the [ICODE]GetRandomNumberInRange()[/ICODE]'s signature too, so that it returns int. | |
Re: [QUOTE=Black Magic;642948]Hey, I have been trying to learn C++ for a few months know but I'm still not 100%. I've got a good book and all that just do get a bit confused. The thing is I want to learn GUI but i'm not sure what to do. Should I … |
The End.