1,174 Posted Topics
Re: The problem probably lies in how you use indexes. Note that array indexes are zero-based i.e. if you have an array holding 5 elements, the last valid index is 4, not 5. Consider [code] const char *article[ 5 ] = {"the", "a", "one", "some", "any" }; int i; // print … | |
Re: Learn to use code tags please ... [url]http://www.daniweb.com/forums/misc-explaincode.html[/url] | |
Re: [QUOTE=Frazinray;624316]Is this simply an installation problem?[/QUOTE] Sounds like one, try adding the Dev C++ .\bin folder into your PATH and see if that makes any difference. Might be that the Dev C++ installer does not comply with Vista leaving some things missing. | |
Re: [QUOTE=Aamit;624434]I m not getting..it.. some more info or example code plz...[/QUOTE] Since you appear to be on Windows, one way is to use GetFileAttributes(), see [url]http://msdn.microsoft.com/en-us/library/aa364944.aspx[/url] | |
Re: [QUOTE=AnjaliAnuradha;624032]I just want to know how the code should be modified to get decreasing order. Please help me.[/QUOTE] You need to study the impact of [icode]if( a[i] > a[j] )[/icode] statement. With regard to the merge sort code you posted, if you can compile it without errors, then get yourself … | |
Re: Use cin .. [code] float f; // input one value cin >> f; // then .. push_back(f) int i; // input one value cin >> i; // then .. push_back(i) [/code] | |
Re: Shouldn't you by now be familiar with code tags?? [url]http://www.daniweb.com/forums/misc-explaincode.html[/url] | |
Re: The memory that argv[0] points to is not writable. [QUOTE] I want to hard code the address in the program. [/QUOTE] Why don't you just do something like [code] opt_httphost = "the hard-coded address"; [/code] | |
Re: Check in the generated msado15.tlh if it contains the ADODB namespace. i.e. see can you find the following in it [code] #include <comdef.h> namespace ADODB { ... [/code] I guess it does, in which case you can use either [code]using namespace ADODB; // or ADODB::_ConnectionPtr m_pConn; [/code] Which compiler are … | |
Re: [QUOTE=marizion;623133]i am currently doing my programming on windows xp home edition service pack 2; i am using dev c++ compiler 4.9.9.2 the name of the tutorial i read is titled "ole drag and drop from scratch" and here is the link: [URL="http://www.catch22.net/tuts/dragdrop.asp"]http://www.catch22.net/tuts/dragdrop.asp[/URL] and my code is [CODE]#include <"windows.h"> #include <"iostream"> … | |
Re: You need to add a new .cpp file, e.g. Form1.cpp, in which you implement the Form1 class's constructor. [code] // Form1.cpp #include "StdAfx.h" #include "Center.h" // include center.h to be able to construct a CCenter object #include "Form1.h" namespace RCK { Form1::Form1(void) { InitializeComponent(); CCenter^ Engine = gcnew CCenter(); } … | |
Re: You might post the Form1.h. | |
Re: This code is capable of only installing and starting the service, it completely lacks the code implementing the actual service, so the error 1053 (ERROR_SERVICE_REQUEST_TIMEOUT) is expected. You might find the following links useful [url]http://www.devx.com/cplus/Article/9857/0/page/1[/url] [url]http://www.codeproject.com/KB/system/nt_service.aspx[/url] | |
Re: I think you could use the following [code] for (int n=0; n <= 8; n++) { if (n != row && Board [row][column] == Board [n][column]) { return false; } if (n != column && Board [row][column] == Board [row][n]) { return false; } } return true; [/code] | |
Re: You open the port specifying FILE_FLAG_OVERLAPPED, but the WriteFile() call is missing the required pointer to an OVERLAPPED structure. (87 == ERROR_INVALID_PARAMETER) | |
Re: Whenever you 'delete' something, that something must have been allocated using the 'operator new', without exceptions. The [icode]delete [] List;[/icode] does the damage which is reported. | |
Re: It's just not legal C, you are expected to write an expression there, not a return statement. | |
Re: I guess you are after this [code] class test { bool is_good; public: test() : is_good(true){} operator void * () { if(is_good) return (void*)this; else return 0; } void go_bad() { is_good = false; } }; int main() { test t; if(t) cout << "good\n"; else cout << "bad\n"; // … | |
Re: A reference for the options [url]http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Warning-Options.html#Warning-Options[/url] | |
Re: [QUOTE=Xokzin;620554]Hi niek_e, I have change the function to this but still I can't get the value. [code=cpp]int updateCorrectTotal(char posi, int poin, int tFoward, int tBack) { if (posi == 'F') return tFoward += poin; else { return tBack += poin; }[/code][/QUOTE] It seems like you might intend to modify tForward … | |
Re: [QUOTE=FTProtocol;618813] Does anyone have any suggestions. [/QUOTE] Whether or not a given application starts up as hidden depends on how the application is coded. I.e. it may be that calc, for example, ensures that it starts up with a visible window. | |
Re: [QUOTE=&rea;620439]it does not work properly[/QUOTE] Could you be more specific about what it fails to do? | |
Re: [QUOTE=Jennifer84;619919]Is this possible to use when you are writing the other code inside a buttoncontrol (Managed Area) ? I had some problem with this before also. [/QUOTE] I think you should very well be capable of using code inside a button click handler i.e. [code] // inside a handler vector<string> … | |
Re: [QUOTE=ambarisha.kn;620451]why we have to use following code in STL programs. why it is needed. [CODE]use namespace std;[/CODE][/QUOTE] It is not obligatory, but if you omit it, then you have to explicitly specify the namespace whenever you access/use something within a namespace e.g. [ICODE][B]std[/B]::string mystring = "test";[/ICODE]. see [url]http://www.cplusplus.com/doc/tutorial/namespaces.html[/url] | |
Re: Here is one example about positioning a dialog box [url]http://msdn.microsoft.com/en-us/library/ms644996(VS.85).aspx#init_box[/url] You can pass the needed 'parent' dialog information through e.g. your dialogs' constructors. | |
Re: See here for information on the permissions [url]http://linux.die.net/man/2/open[/url] [QUOTE][B]always[/B] it copy a binary into another which is just [B]empty file[/B][/QUOTE] You might post this code that always produces empty copies so we can see what goes wrong. | |
Re: You need to include the .cpp file, containing the ExecProcess() code, to your build process. If you are working with an IDE, add that file to your project. | |
Re: OP posted Jul 18th, 200[COLOR="Red"][B]3[/B][/COLOR] ... :icon_wink: | |
Re: See the comments for explanation for the error ... [CODE] void *audio::audioThread( void *ptr ) { [B] // ptr is [COLOR="Red"]NULL [/COLOR]here[/B] audio *play = (audio *)ptr; // now you call playAudio() through a NULL pointer play->playAudio(); delete play; return NULL; } void audio::playAudio(void) { // here the 'this' pointer … | |
Re: [QUOTE=Radical Edward;619747] Edward doesn't have a solid reference on hand, but I don't think you can make a single non-static method be a friend. The friend has to be a non-member function or a whole class.[/QUOTE] Actually a member function can also be friend (just like the two functions in … | |
Re: [QUOTE=CodeBoy101;619844]Actually no, I get an error message saying: "cannot convert from std::string to const char." The parameters for strcat are: (char*, const char).[/QUOTE] I assume variable2 is std::string, in which case you are to use: [code]strcat(variable1, variable2.c_str());[/code] Just in case you are not too familiar with std::string, you can avoid … | |
Re: Very difficult to say much without knowing more about those errors .. so you might post them. | |
Re: [QUOTE=VernonDozier;619367] [code] while (!cin.eof()) [/code] I've never used cin.eof() but I can't get this condition to fail regardless of what I type, so I end up in an infinite loop.[/QUOTE] The loop breaks when you enter Ctrl+Z. | |
Re: [QUOTE] For the line below, the code also attach some text to the diagram "Curve1" so this text adds each time I press the button. So it seems that a line and the text just adds for each buttonpress. [code]LineItem ^myCurve; myCurve = myPane->AddCurve( L"Curve1", list, Color::Red, SymbolType::None );[/code] [/QUOTE] … | |
Re: [QUOTE=m4design;618751] Or maybe you shout try adding this function before every cin statement: [B][COLOR="Red"]fflush(stdin);[/COLOR][/B] This will tae care of in reaming input from the standard input. If i'm saying something wrong I hope someone will correct me.[/QUOTE] [COLOR="Red"]Don't do that[/COLOR], see here [url]http://www.gidnetwork.com/b-57.html[/url] | |
Re: [QUOTE=CodeBoy101;619010]Is there a way to convert from an integer to a string?[/QUOTE] Yes, one way of doing it is ... [code] #include <iostream> #include <sstream> #include <string> using namespace std; int main() { int x = 123; stringstream ss; string s; ss << x; ss >> s; cout << s; … | |
Re: If I understood, you need to make your window to appear on top, in that case lookup the SetWindowPos() function. | |
Re: It is some sort of project configuration mismatch, you could post the complete command line of the compiler. Try looking in Project/Properties/Configuration Properties/C/C++/Command Line. | |
Re: You simply need to initialize the pointers ... [code=cpp] nodePtr head = 0; nodePtr current = 0; [/code] The extern declarations of the pointers you have there, do not impact the actual variables' values in any way, in case you were expecting that to happen. | |
Re: [QUOTE=williamhemswort;618580]What is causing this difference in speed? :icon_rolleyes:[/QUOTE] You might be interested in the amount of memory de/allocation operations that occur during the tests. Gathering basic statistics on malloc/free/realloc calls is quite simple by means of _CrtSetAllocHook(), see [url]http://msdn.microsoft.com/en-us/library/820k4tb8(VS.80).aspx[/url] | |
Re: [QUOTE=FTProtocol;618448] Im really not sure why but it doesn't hide the window, i checked everything i could see but i think i've still done something wrong. any ideas? :([/QUOTE] Use the STARTF_USESHOWWINDOW flag ... [CODE] PROCESS_INFORMATION info; STARTUPINFO startup; memset(&startup, 0, sizeof(startup)) ; memset(&info, 0, sizeof(info)) ; startup.cb = sizeof(startup); … | |
Re: [QUOTE]can u write the whole code for me once...plz... and you can use inheritance and arrayas well plz use the easiest way and reply as soon as possile[/QUOTE] I think that will not happen, see here [url]http://www.daniweb.com/forums/announcement8-2.html[/url] If you post your effort (the code you've done this far), then you'll … | |
Re: If I understood the question correctly, then you need to add the following in your WM_INITDIALOG handler ... [icode]ModifyStyle(YOUR_DLG_HWND, 0, WS_SYSMENU|WS_MINIMIZEBOX, 0);[/icode] | |
Re: [QUOTE]Then i receive a "properties.exe has encountered a problem and needs to close. We are sorry for the inconvenience." Windows error message. [/QUOTE] Appears as if lpszString would be NULL, so try adding a check against that condition ... [CODE] BOOL CALLBACK PropEnumProcEx(HWND hwnd, LPTSTR lpszString, HANDLE hData, ULONG_PTR dwData) … | |
Re: [QUOTE=zzmgd6;617664]I wish I could find my old code.[/QUOTE] Somewhat off topic, but anyway, I think you might benefit from having your code under version control, here is one pointer to get you started with it ... [url]http://subversion.tigris.org/[/url] | |
Re: You might use seekg() along with tellg(), see here for an example [url]http://www.cplusplus.com/reference/iostream/istream/tellg.html[/url] | |
Re: The following should work ... [CODE] private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { for ( int i = 0; i < checkedListBox1->CheckedItems->Count; i++ ) { listBox1->Items->Add ( checkedListBox1->[B]GetItemText[/B](checkedListBox1->CheckedItems[i]) ); } [/CODE] | |
Re: Related to posting ... In case you haven't noticed, there is also a "Preview Post" button available. Press that button and you'll see a preview of how your post will look like. It does not submit your post, it just displays the preview. | |
Re: The value of 'x' is invalid subscript at the point where the error occurs, it exceeds the size of Store2. You are using uninitialized variables (x, a) there, it's a bad practice. [code]void Write_Data(vector <Weather> Data) { double count, y, z, angle1, angle2, count2; int x, a, b; [B] // … | |
Re: The following might work for you, assuming that the values are always comma-separated [code] string line; double x,y,z; char dummy; // for skipping commas while ( getline(canopyfile, line) ) { stringstream iss(line); if(iss >> x >> dummy >> y >> dummy >> z) { holder.setx(x); holder.sety(y); holder.setz(z); canopyvec.push_back(holder); } else … |
The End.