1,174 Posted Topics
Re: [QUOTE=anuizath2007;642705]why wont this one work???????....[/QUOTE] Be more specific about what is not working, spend some time trying to describe the exact problem(s), instead of just posting slightly modified code time after time (without [URL="http://www.daniweb.com/forums/misc-explaincode.html?TB_iframe=true&height=400&width=680"]code tags[/URL]). Then about arrays and indexes, assuming that you eventually choose to have an array of … | |
Re: [QUOTE=angelsherin;642139]Hi thanks for responding me and i just check as u told...if i select the "Release Mode" from IDE then i Compile and run the application then it works fine..But if i run the application with the exe (Clicking the exe)which i got from release folder,i got the user defined … | |
Re: [QUOTE=Sa_FF;641367]this problem i fixed \o/ now... it wont let me declare more variables :S[/QUOTE] It's really best if you just post the code you are having problems with, explaining what the trouble is. | |
Re: [QUOTE=nokeekon;640437]Doesn't seem to work. Umm... i guess what i'm really looking for is an example to play a sound file while the user is going through the program and an example that would stop the sound.[/QUOTE] Maybe you tried it the wrong way, the following plays a .wav file [code] … | |
Re: Please use code tags when you post code. Mostly you have there comments not marked as comments, and also a couple of semicolons were missing ... Use the VC++ editor to edit code, so you'll benefit from its syntax colouring, effectively meaning less errors. [code] #include "stdafx.h" #include <iostream> using … | |
Re: [QUOTE=Prabakar;640718]Why all of the sudden old threads are renewed ? I made a reply to an old thread by accident & I did apologize for that. Now 2 more have been renewed.[/QUOTE] I think it just happens quite easily, consider a newbie who reads a thread and maybe sees something … | |
Re: [QUOTE=solaf_111;640687]yes, i do full path & put it in the same folder both the same problem[/QUOTE] Could it be that the [I]current working directory[/I] (the lpDirectory argument) is not what it should be at the time you call ShellExecute(), i.e. proto1 does not find the files? Note that you should … | |
Re: I'm repeating VernonDozier here ... [URL="http://www.daniweb.com/forums/misc-explaincode.html"]Code tags and formatting please:[/URL] Just so that you get the file reading working, the following is almost completely wrong (the use of placing the read operation inside the while() is good) [code]while (hours, employee, payrate, taxbracket, exemptions >> inFile)[/code] Assuming you have five numbers … | |
Re: [CODE]#define NUMBER 0 clips[ NUMBER ].x = 240 [/CODE] Would you mind posting the error message(s) that you get using the above non-working construct? And what is your compiler? | |
Re: You only have storage for two CTreeComponent pointers ... [ICODE]CTreeComponent* m_children[2];[/ICODE] the [ICODE]add(...)[/ICODE] method could check that you are not using out of bounds indices. | |
Re: [QUOTE=amrith92;639886]Thanks for your reply, but I have Visual C++ 2005 (professional) on the computer, but it won't compile it for me anyway, so that's when I tried it on the 2008 express edition( which didn't work). Is there anything radically wrong with the code or is it the program?[/QUOTE] Are … | |
Re: [QUOTE=iansane;638793] It still gives "error...program has to close" unless I put the ios::ate back in. For some reason, that makes it stay open, but it's not printing out anything. Like the vector is empty. [/QUOTE] Didn't your compiler complain about the following line? [code] for (iter [COLOR="Red"]=[/COLOR]= data.begin(); iter != … | |
Re: [QUOTE=michinobu_zoned;633019]How do I read up on exec? What, man exec in the terminal?[/QUOTE] Here is the link John A posted ... [url]http://www.opengroup.org/onlinepubs/000095399/functions/exec.html[/url] | |
Re: If you have [ICODE]LinkList::insert( const char * lib );[/ICODE] You have to use it with [ICODE]std::string[/ICODE] like [code] while( getline( fin, lib, '\n' ) ) { game.insert( lib.[COLOR="Red"]c_str()[/COLOR] ); // <- passes the data as const char * cout << lib; } [/code] Whether it really works as intended depends … | |
Re: Not sure what the actual problem is, but maybe you are missing [ICODE]ios::ate[/ICODE] so that the file does not get truncated each time you open it, i.e. [code] file_op2("c:\\arun.txt", ios::out|[B]ios::ate[/B]); [/code] | |
Re: You need to open the file in binary mode in order to prevent CR/LF translation. [CODE]char * fbuffer; long fsize; ifstream cpy ("sample.txt", [B]ios::binary[/B]); ... [/code] Writing a '\0' at the end of file does not fix the problem. | |
Re: Here is some general information on background applications (a.k.a. services or daemons) ... [url]http://en.wikipedia.org/wiki/Daemon_%28computer_software%29[/url] | |
Re: [QUOTE=driplet;638283](maybe just change the caption of the button? I guess) [/QUOTE] Use [URL="http://msdn.microsoft.com/en-us/library/ms633546(VS.85).aspx"]SetWindowText()[/URL] | |
Re: [ICODE]SetPriorityClass[/ICODE] takes the handle of the process, not the thread's handle. So you need to have [code]HANDLE hProcess = GetCurrentProcess(); [/code] [QUOTE]Is there a utility to view threads and how they tick on and off of the processor?[/QUOTE] You might use [URL="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx"]Process Explorer[/URL] | |
Re: [QUOTE=QuantNeeds;637719]I need to pass a non-static data member in one class (class Disks, data member disks) to another class (ToH) to its static bool function, so I can test that value.[/QUOTE] In that case, modify the [ICODE]ToH::test()[/ICODE] to take as an argument a variable of type [ICODE]Disks[/ICODE], i.e. [code] bool … | |
Re: [QUOTE=anuizath2007;638145]i dont understand watz rong w dis.........[/QUOTE] Please, take some time and read the section [URL="http://www.daniweb.com/forums/faq.php?faq=daniweb_policies"]Keep It Clean[/URL] | |
Re: You need to be more specific about the listboxes. Are they MFC's CListBoxes or generic Windows LISTBOXes or some other type of listboxes?? | |
Re: [QUOTE=integer*09;637970]ofstream nnewfile (textBox2->Text &".txt");[/QUOTE] If you use VC 2008, you can convert textBox2->Text to std::string using [URL="http://msdn.microsoft.com/en-us/library/bb384859.aspx"]marshal_as[/URL] or with earlier versions, e.g. [url]http://msdn.microsoft.com/en-us/library/1b4az623.aspx[/url] | |
Re: [ICODE]if(Disks::disks == 1) [/ICODE] will work only if the [ICODE]disks[/ICODE] is a [I]static[/I] variable, i.e. [code] class Disks { ... static int disks; ... }; [/code] If it's not feasible to have it as static, then you need an Disks object, i.e. [code] void some_function(Disks & aDisk) { if(aDisk.disks == … | |
Re: You can use the [I]init_priority[/I] attribute to have the initialization take place in correct order, see [url]http://gcc.gnu.org/onlinedocs/gcc-3.3.2/gcc/C---Attributes.html#C++%20Attributes[/url]. And maybe you find the following useful too [url]http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12[/url] | |
Re: You are not allocating enough storage, change from [code] prior = (double*) malloc(nzcwint); [/code] to [code] prior = (double*) malloc(nzcwint * sizeof(double)); // + allocation of cwint in same fashion ... [/code] Then again, why aren't you using new/delete, i.e. [code] prior = new double[nzcwint]; // etc // and eventually … | |
Re: [QUOTE=solaf_111;637505]i read the file line by line then store the lines in strings but the space that is in the begin of line i want remove it before read the line and store it in the strings[/QUOTE] Does the following make things clearer ? [code] std::string line; // read a … | |
Re: [QUOTE=cam875;635872]I want the program to shut down on line 27 and lines 28-33 I am trying to make something so if anyone types a command that is not programmed it will display an error message[/QUOTE] wrt lines 28-33, you need then change to [code] if (choice == 5) ; else … | |
Re: You might use std::string find() to see if the line contains the search string. And when it does, you can extract the rest of the line using std::string substr(). [URL="http://www.cppreference.com/cppstring/find.html"]find()[/URL] [URL="http://www.cppreference.com/cppstring/substr.html"]substr()[/URL] | |
Re: [QUOTE=lahom;636764]hi i have an application made of several dialogs each has its own exit button my question: whan i press the exit button ... iwant to exit the whole application (not exit the present dialog and return to the Previous one ) how can i do that .....please help me … | |
Re: ParamValue must point to a large enough buffer to receive the information. The documentation should provide information wrt 'large enough buffer'. You might use something like [code] const int GETMOVING_SIZE 1024; char paramValue[GETMOVING_SIZE] = {0}; if(LT360LIB_CmdValue(handle, lt_GetMoving, paramValue)) { // here you can check the content of paramValue } [/code] | |
Re: [QUOTE=mike issa;634504]hi all i was a able to create a .def file from lt360lib.dll using Borland C++ (impdef.exe) [CODE]LIBRARY LT360LIB.DLL EXPORTS LT360LIB_CloseLink @3 LT360LIB_Cmd @7 LT360LIB_CmdIndexValue @9 LT360LIB_CmdString @10 LT360LIB_CmdValue @8 LT360LIB_GetDllVerDate @1 LT360LIB_GetUsbFirmwareVerDate @6 LT360LIB_LinkedCnt @2 LT360LIB_OpenLinkCOM @5 LT360LIB_OpenLinkUSB @4 LT360LIB_ReadBinary @12 LT360LIB_WriteBinary @11 [/CODE] how can i convert … | |
Re: [QUOTE=ThomYork;635577] [CODE] system("\"C:\\Documents and Settings\\myUser\\myProject\\app.exe\" -vb \"C:\\Documents and Settings\\myUser\\file.txt\""); [/CODE] [/QUOTE] Try this one .. [code] system("[COLOR="Red"]\"[/COLOR]\"C:\\Documents and Settings\\myUser\\myProject\\app.exe\" -vb \"C:\\Documents and Settings\\myUser\\file.txt\"[COLOR="Red"]\"[/COLOR]");[/code] | |
Re: You increment [ICODE]i[/ICODE] too early ... [code] emp1[i]->setProperties(emp_id,fname,lname,hours_worked,hourly_rate,employee_type_flag,given_gross_pay); i++; // [COLOR="Red"]<- incremented too early[/COLOR] employee::headers(); // emp1[i] is not pointing to an allocated item at this point emp1[i]->calc_gross_pay(); [/code] Note that you are not handling the case where employee_type_flag is something else than 's' or 'h'. | |
Re: [QUOTE=Aamit;635719][COLOR="Red"]Code is compiling.[/COLOR] [/QUOTE] Which compiler are you using? E.g. [ICODE]char buff[str.size()];[/ICODE] should cause an error. | |
Re: Maybe you have a following kind of scenario ... [code] void fun1(); void fun2() { fun1(); } void fun1() { fun2(); } int main() { fun1(); return 0; } [/code] | |
Re: [QUOTE=mike issa;634365]Thanks for the reply my friend when i try to use "e:\>bcf\bin\impdef lt360lib.dll > lt360lib.def" i get this "Syntax: IMPDEF [options] destname[.def] srcname[.dll] Options: -h Emit hints " and another question where should the output be located, is it in the same directory where the impdef.exe is located ? … | |
Re: Adding to what niek_e already mentioned, something like the following might be close to what you are after ... [code] for(double i = 0; i < 1.05; i += 0.05) { this->Opacity = i; this->Refresh(); } [/code] [QUOTE]I am trying to "Fade In" a Form when this form is opened[/QUOTE] … | |
Re: For example ... [ICODE]printf("%03d", 12);[/ICODE] prints: 012 [URL="http://www.cplusplus.com/reference/clibrary/cstdio/printf.html"]printf()[/URL] | |
Re: [QUOTE=Aamit;634955][code] Day: printf("\n1:Mon\t2:Tue\t3:Wed\t4:Thu\n5:Fri\t6:Sat\t7:Sun\nEnter value-> "); scanf("%d",&x); char dd1[5]="MON"; char dd2[5]="TUE"; char dd3[5]="WED"; char dd4[5]="THU"; char dd5[5]="FRI"; char dd6[5]="SAT"; char dd7[5]="SUN"; if(x==1){ strcpy(dd,dd1); } if(x==2){ strcpy(dd,dd2); } if(x==3){ strcpy(dd,dd3); } if(x==4){ strcpy(dd,dd4); } if(x==5){ strcpy(dd,dd5); } if(x==6){ strcpy(dd,dd6); } if(x==7){ strcpy(dd,dd7); } //printf("%s",dd); if(x>7 || x<1) { cout<<"\nPlease Enter Valid Option\n"; … | |
Re: [QUOTE=SteveDB;632604]no numeric value activates my functions.[/QUOTE] Two [COLOR="Red"]changes[/COLOR] ... [code] # include "stdafx.h" # include <iostream> # include <cmath> # include <xutility> # include <stdlib.h> # include <cctype> # include <conio.h> # define PI 3.1415926535898 using namespace std; double Rise1 = 0; //for vertical data input of 1st roof slope-- … | |
Re: [QUOTE=inventer;634421]Hi! #include <stdio.h> main() { int p, n; float r, si; printf("Enter values of p, n, and r"); scanf("%d, %d, %f", &d, &d, &f); si=p*n*r/100; printf("Simple interest=%f", si); getchar(); return 0; } There is no error in this program. Output is also right but only for small integers. [/QUOTE] I … | |
Re: This seems to be a feature in VS. If you look into the Form's InitializeComponent() code, you'll see that the Designer has added the second panel as a control of the first one, i.e. something like: [ICODE]this->panel43->Controls->Add(this->panel41);[/ICODE] This arrangement seems to occur acutomatically whenever the two panels overlap in the … | |
Re: [QUOTE=Prathvi;623733] The problem is that The read file is written completely into file.[/QUOTE] The code seems to try to do just that, i.e. as long as data is successfully read, write the data. Maybe you need to add some code that breaks the loop based on some condition? Or did … | |
Re: [QUOTE=Percey;633938]I still havent figured this one out[/QUOTE] Have you tried the printer vendor's support facilities? | |
Re: The first time you print 'i', it has the initial unknown value it got from 'ch'. If you add the [COLOR="Green"]green[/COLOR] and [COLOR="Red"]red[/COLOR] lines below, you'll probably get the idea ... [code] // morechar.cpp -- char and int types contrasted #include <iostream> int main() { using namespace std; char ch; … | |
Re: [QUOTE=FTProtocol;632637]its been done in VB so i dont see why it cant be done in c++.....[/QUOTE] [URL="http://www.codeproject.com/KB/threads/winspy.aspx"]http://www.codeproject.com/KB/threads/winspy.aspx[/URL] | |
Re: Have you considered what the code does when e.g. OpenProcess(), GetModuleBaseName() or GetWindowTextA() fails? | |
Re: [QUOTE=ibe123;633000]Hi Thanks again, My final problem is I do not know how to do this with functions. Can you lead me in the right direction?[/QUOTE] Well, the first required function is the [ICODE]bool isATriangle(const double s1, const double s2, const double s3);[/ICODE] With regard to that, you could have something … |
The End.