209 Posted Topics

Member Avatar for suncica2222

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]

Member Avatar for suncica2222
0
166
Member Avatar for darkdai

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.

Member Avatar for nbaztec
0
152
Member Avatar for saransh60

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: …

Member Avatar for nbaztec
0
100
Member Avatar for lukename
Member Avatar for kchyn

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]

Member Avatar for nbaztec
0
196
Member Avatar for DanHu

<< (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 …

Member Avatar for nbaztec
0
205
Member Avatar for Garrett2011
Member Avatar for pawan_sharma777

[CODE]student stud; //Input values to stu file.write(reinterpret_cast<char*>(&stu),sizeof(student);[/CODE]

Member Avatar for nbaztec
0
155
Member Avatar for harpay

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 …

Member Avatar for nbaztec
0
582
Member Avatar for muze

1) Maybe because the class does *not* include the header of the ListBox item. 2) Try this: [CODE] DWORD dw = 100; str += dw; [/CODE]

Member Avatar for Ancient Dragon
0
137
Member Avatar for madhub2v

[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 …

Member Avatar for daviddoria
0
136
Member Avatar for Jsplinter

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]

Member Avatar for Jsplinter
0
2K
Member Avatar for malvi

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]

Member Avatar for malvi
0
230
Member Avatar for nbaztec

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) …

Member Avatar for Fbody
0
118
Member Avatar for itiwcsingkaww

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 …

Member Avatar for nbaztec
0
194
Member Avatar for captainSheepdog

As far as VCL is concerned, a Label is created at runtime as: [CODE]TLabel *myLabel = new TLabel(<Owner Handle>);[/CODE]

Member Avatar for captainSheepdog
0
103
Member Avatar for nbaztec

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 …

Member Avatar for mrnutty
0
578
Member Avatar for NickDX

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 …

Member Avatar for Frederick2
0
188
Member Avatar for johnnyturbo3

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 …

Member Avatar for johnnyturbo3
0
333
Member Avatar for frogboy77

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.

Member Avatar for frogboy77
0
723
Member Avatar for rocky_kuet
Member Avatar for nbaztec

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

0
80
Member Avatar for nbaztec

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 …

Member Avatar for nbaztec
0
142
Member Avatar for watz_uph
Member Avatar for watz_uph
0
156
Member Avatar for saqib_604

You should try looking into operator overloading: [CODE] int* operator >> (int *RHS) { RHS = this->array; return RHS; //For chaining } [/CODE]

Member Avatar for mrnutty
0
297
Member Avatar for jeffpro

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.

Member Avatar for mitrmkar
0
101
Member Avatar for Jeevitha V.K

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!

Member Avatar for finito
-6
159
Member Avatar for empror9

[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 …

Member Avatar for empror9
0
133
Member Avatar for adaniel058

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 …

Member Avatar for adaniel058
0
368
Member Avatar for HAIDER69

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]

Member Avatar for HAIDER69
0
3K
Member Avatar for dhruv_arora

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') { …

Member Avatar for nbaztec
0
163
Member Avatar for jimJohnson

>>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 …

Member Avatar for nbaztec
0
371
Member Avatar for grux12

>>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 …

Member Avatar for nbaztec
0
161
Member Avatar for gameon
Member Avatar for youllbelost
Member Avatar for jadrian

>>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.

Member Avatar for nbaztec
0
236
Member Avatar for Isabelle

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 …

Member Avatar for Isabelle
0
153
Member Avatar for darkseid

[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]

Member Avatar for nbaztec
0
111
Member Avatar for jrayborn66

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]

Member Avatar for nbaztec
0
184
Member Avatar for YasaminKh
Member Avatar for madzam

Syntactically your code *appears* to be correct. You could try elaborating a bit further.

Member Avatar for nbaztec
0
115
Member Avatar for darksmokepunch

>>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 …

Member Avatar for darksmokepunch
0
127
Member Avatar for bbman

[CODE]class MyItemGroup { public: Item myItem; };[/CODE] Something like this?

Member Avatar for jonsca
0
130
Member Avatar for aj79

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 …

Member Avatar for aj79
0
215
Member Avatar for daviddoria

Shouldn't this be in [URL="http://www.daniweb.com/forums/forum112.html"]Perl[/URL] forum?

Member Avatar for daviddoria
0
90
Member Avatar for uhmyeah

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 = …

Member Avatar for nbaztec
0
168
Member Avatar for julyn13
Member Avatar for nbaztec
0
290
Member Avatar for morelve

>>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.

Member Avatar for Adak
0
3K
Member Avatar for vbx_wx

[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 …

Member Avatar for nbaztec
0
268
Member Avatar for nbaztec

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 …

Member Avatar for nbaztec
1
144

The End.