209 Posted Topics
Re: Well yes. You can pretty much fwrite a file, then ShellExecute it to open it from the disk using it's current associated editor. [CODE] FILE *file = fopen("D:\\myText.txt","w"); fputs(file, "HellO"); fclose(file); ShellExecute(NULL,"open","D:\\myText.txt","","", SW_NORMAL); [/CODE] | |
Re: Yes you can provided you have your own GSM band or find some service provider which by all means would be more than happy to charge you for it. Still it will be far from being an IRC. | |
Re: lets make it a bit simpler: [CODE] int foo = 5; const int cfoo = 10; const int* p = &foo; //Pointer to constant //Since it's a pointer to a constant, *p = 10 won't work int* const p = &cfoo; //Constant pointer (initialization necessary) //Since it's a constant pointer: … | |
| |
Re: Sure it is: [CODE]while(1) { string fileName1 = "A_asdf.txt"; string fileName2 = "A_asdf2.txt"; CopyFile(fileName1, fileName2); fileName2 = fileName1; fileName1.replace(1,1,fileName[0]++); }[/CODE] | |
Re: << (LS) can be seen as a multiplication by 2 >> (RS) can be seen as a division by 2 so a number can be divided in terms of powers of 2 as: [CODE]int Divide ( int intVal, int powerOfTwo ) { if( !powerOfTwo ) return intVal; else return intVal … | |
Re: No. Each unit has it's own #include. Only the project cpp has #includes of all units. | |
Re: [CODE]student stud; //Input values to stu file.write(reinterpret_cast<char*>(&stu),sizeof(student);[/CODE] | |
Re: Think your logic through first, only then the code will follow. Take this example: I want to buy 3 Power Ranger Action figures for 3 kids: -> 2 want Power Ranger Dino Force (@ $2) -> 1 wants Power Ranger SPD (@ $3) So my bill look like: [CODE]--------------------------------------- 09/19/2010 … | |
Re: 1) Maybe because the class does *not* include the header of the ListBox item. 2) Try this: [CODE] DWORD dw = 100; str += dw; [/CODE] | |
Re: [CODE] int main() { int gDriver=DETECT; //Detect the top priority graphic Driver. int gMode; initgraph(&gDriver, &gMode, <path to bgi directory: string>); //Initialize the graphic Mode. //Do something closegraph(); //Terminate graphic mode. restorecrtmode();//<--This is important. Restore to previous mode (Text mode) return 1; } [/CODE] This should be sufficient but BGI … | |
Re: One way would be to read 8 bytes & push_back the values into the deque. [CODE] double dub; dq.erase(); //drop elements, if any while(!myfileIN.read(&dub,sizeof(double)) dq.push_back(dub); myfileIN.close(); [/CODE] | |
Re: Well why not create your own function? [CODE] std::string HexToStr(const int value, int width) { std::string hexStr; std::stringstream num; num.width(width); num.fill('0'); num << std::fixed << std::hex << value; hexStr = "0x" + num.str(); return hexStr; }[/CODE] Usage: std::cout << [COLOR="Green"][B]HexToStr(0x0004, 4);[/B][/COLOR] | |
Consider the following code: [code] const int con = 100; int &ref1 = 10; //Where is this 10 stored? int &ref2 = con; ref1 = 20; ref2 = 90; cout<<ref1<<con<<ref2; [/code] This outputs: 20 100 90 My only queries are: a) Where is the hard coded number 10 stored? b) … | |
Re: Excerpt from wiki: In mathematics, the greatest common divisor (gcd), also known as the greatest common denominator, greatest common factor (gcf), or highest common factor (hcf), of two or more [B]non-zero integers[/B]. Some recursive algo I remember off the top: procedure gcd(a,b) .if b = 0 then return a .else … | |
Re: As far as VCL is concerned, a Label is created at runtime as: [CODE]TLabel *myLabel = new TLabel(<Owner Handle>);[/CODE] | |
Basically, I didn't know where to put this so I choose the Super of the 2 Languages. Our lecturer gave us an assignment to lay out diff. b/w C & C++, which started with a rather dirty spurge of concepts. He stated: In C program , the MAIN() should NOT … | |
Re: One way might be to change the creation order of forms so that Form1 is created last. Then in the initialization code you can assign to a global object the handle value & use it in your form through ShowWindow(). Personally, I include the "Form1.h" into my "Main.cpp" & use … | |
Re: You shouldn't fret about it. The string will automatically resize depending upon the RAM available until you run out of it, which IMO shouldn't be happening. The common SQL Query might be: [CODE]SELECT <Fields> FROM [Table] WHERE <Condition> GROUP BY <Field> ORDER BY <Field>[/CODE] In the above code the only … | |
Re: Well you're dealing with integer [URL="http://www.cplusplus.com/doc/tutorial/variables/"]Ranges[/URL]. Apart from that for a specific purpose you can apply the size modifiers (long/unsigned) & even use __int64. | |
Re: No code tags. Non-standard code. Spaghetti code. Double Post. | |
To avoid double postings kindly refer the thread here, since I couldn't make up, which forum was best suited. [URL="http://www.daniweb.com/forums/post1297528.html#post1297528"]http://www.daniweb.com/forums/post1297528.html#post1297528[/URL] Please do take part in the discussion. Regards, Nisheeth Barthwal | |
I've recently been programming J2ME apps for Mobiles when it struck to me - something I remembered: "A virus infected my mobile!". I find it strange. Obviously, the regular EXE files don't work on JVM so can no way infect mobile phones. So there should be Java-specific viruses, but J2ME … | |
Re: Use getline(<istream>,<buff>,<delimiter>). Delimiter will be a ','. | |
Re: You should try looking into operator overloading: [CODE] int* operator >> (int *RHS) { RHS = this->array; return RHS; //For chaining } [/CODE] | |
Re: Well you can use [URL="http://www.google.co.in/search?sourceid=chrome&ie=UTF-8&q=cmsdn+sendinput"]SendInput()[/URL] but it kinda works the same way as mouse_event() so may be considered cheating. | |
Re: I don't know what good can come out of this! Still speaking of lionanees's bizarre technique, just put that in a function which call's itself recursively. :-\ Sigh! | |
Re: [QUOTE]but i want to be the same name in the div function?[/QUOTE] What's stopping you? [QUOTE]why i must declare the variables of my functions in the main function again?[/QUOTE] No you don't have to. Local variables are block specific(read: [URL="http://icecube.wisc.edu/~dglo/c_class/scope.html"]Variable Scope[/URL]). The variables you declare in main() aren't accessible in … | |
Re: I'd echo with Excizted, I can't make anything out of your example [CODE]3 3 90 35d43m9s45d45m19s8 36d46m19s51d25m18s45 36d46m19s11d25m39s 7 35 23 9 25 43 9 25 25 43 9 35 33 39 30 32 33 9 17 33 22 6 15 43 19 25 43 29 108 39 33 40 … | |
Re: So basically you need the Arithmetic difference of both arrays, something like this: [CODE] int* getDiff(int *arr1, int *arr2) { int maxCount = 1750; //From your 1st Post int *result = new [maxCount]; for(int i=0 ; i<maxCount ; i++ ) result[i]=arr1[i]-arr2[i]; return result; } [/CODE] | |
Re: I remember my first test masking program - the good 'ol days with TC(yuck!) & non-standard C++. Yes, jonsca is right & getch() had the key role in it. My code was somewhat like this: [CODE] char pass[50]; int i=0; while(1) { char ch = getch(); if(ch == '\r') { … | |
Re: >>Wrong thread Was there a pun intended? >>This is alll I have found so far and do not think it is right.. This is straight from MSDN, what makes you think otherwise? During multi-threading you have virtually no control so as which thread finishes first, provided they were all launched … | |
Re: >>int battleXpCalc ( int oppLevel, ..., char evo(3) )[B][COLOR="Red"];[/COLOR][/B] { Undesired semi-colon. >>char [COLOR="red"][B]battlePoke(20)[/B][/COLOR], int neededXp, int evoLvl,[COLOR="red"] [B]char evo(3)[/B][/COLOR] Not allowed. Default arguments have to be chained. >>void battleXpCalc >>int battleXpCalc Different return type but similar arguments - Not overloaded. >>battlePoke = "Wartortle"; Can't assign array's like this. Use … | |
![]() | |
Re: >>glTranslatef(0.0f, 0.0f, [B]-5.0f[/B]); [-5.0,5.0] is the limit of ACS-triad axis, which is mapped to your screen. For Z [0.0f,-3.0f] should be plausible. | |
Re: A static member does not belong to the object(this), rather, belongs to the class. The following code should make it more clear: [CODE] class foo { public: static int foo1; //Static member int foo2; //Regular member }; int main(int argc, char *argv[]) { foo Obj; Obj.foo2 = 2; //Correct Obj.foo1 … | |
Re: [QUOTE]i've tried like 10312312418312 methods and still couldn't make it work.[/QUOTE] Try putting it in else part. :-/ [CODE] if (strcmp ( a[i].word, search_word ) == 0) { .. } else { .. if (strncmp ( a[i].word, search_word,2 ) == 0 && z == 1) { .. } } [/CODE] | |
Re: What exactly is the problem you are facing. 1. Avoid void main(), it's non-standard. 2. Avoid system() calls, since they are worthless & slow 3. Also I recommend you use a class for this. [CODE]class Student { int id; char Answers[20]; }; //Create 50 Objects Student Students[50]; [/CODE] | |
Re: 1) Use input.c_str() 2) Add ; at line 13 3) Uncomment fclose | |
Re: Syntactically your code *appears* to be correct. You could try elaborating a bit further. | |
Re: >>I'm creating a text-based rpg Text based rpg's are quite hard to design initially. If you're starting off with classes & OOP concepts I suggest you design a check-board game such as chess or checkers. When you feel comfortable with the array/matrix & the complexity, then I'd suggest you look … | |
Re: [CODE]class MyItemGroup { public: Item myItem; };[/CODE] Something like this? | |
Re: If you think even [B]unsigned long long[/B] will be insufficient to hold the sum, there may come a case when even num would throw a out of range exception for a 100-digit number. Your best bet in that case would be to use it as a STL string, but since … | |
Re: Shouldn't this be in [URL="http://www.daniweb.com/forums/forum112.html"]Perl[/URL] forum? | |
Re: Shouldn't this be: ball.y += ball.velocity.y + GRAVITY * dt; this: ball.y += ball.velocity.y*dt + (GRAVITY*dt*dt)/2 Gravity should be treated as a (physics)vector. In a 2-D scenario the Gravity vector will have 2 components. X & Y. [CODE] struct LineVector { float x; float y; }; LineVector Gravity; Gravity.x = … | |
Re: For one, look at the date of the first post. For two, why can't you just change ur password!! :-/ | |
Re: >>Google got me nowhere Then you didn't do enough of it. There are tons of tutorials on web. Some are here at [URL="http://www.daniweb.com/"]DaniWeb [/URL]& I've posted to at least 5 such queries in past 3 days. Search properly. | |
Re: [CODE] bool flag=false; node *temp = head; for(int i=0;(temp!=NULL) && i<n;i++, temp=temp->next) { if(i==n) { flag =true; break; } } if(flag) return temp; else return NULL; [/CODE] If you keep a track of your elements, your double-linked list can index faster by searching from either head or tail by comparing … | |
Due to various posts asking for syntax highlighting, I decided to give it a shot & come up with a Syntax Highlighter for multiple languages. Also as many posters want to Copy it to Word, I added a functionality to directly export the highlighted code to MS-Word. Both the highlighting … |
The End.