1,174 Posted Topics

Member Avatar for gh0sst

Maybe this will do ... [ICODE]RedrawWindow(hConsoleWnd, 0, 0, RDW_INVALIDATE);[/ICODE] [ICODE]hConsoleWnd[/ICODE] is the console's window handle.

Member Avatar for mitrmkar
0
409
Member Avatar for Aamit

This is a modified version of niek_e's code [code] #include <iostream> #include <fstream> #include <string> #include <sstream> using namespace std; int main() { ifstream in; in.open("c:\\yourfile.txt"); if (!in.is_open()) { cout << "Can't open file\n"; return 1; } string line; // read one line at a time while (getline(in, line)) { …

Member Avatar for mitrmkar
0
110
Member Avatar for hemendra.jadaun

[QUOTE=hemendra.jadaun;632654]can anybody solve this problem.. Linking... gdtopng.obj : error LNK2001: unresolved external symbol __imp__gdImageDestroy@4 gdtopng.obj : error LNK2001: unresolved external symbol __imp__gdImageCreateFromGd@4 Debug/gdtopng.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. gdtopng.exe - 3 error(s), 0 warning(s)[/QUOTE] Try linking with bgd.lib.

Member Avatar for mitrmkar
0
50
Member Avatar for Superfat

[QUOTE=Superfat;632221]I tried it, and recieved an error, [code] [Linker error] undefined reference to `WinMain@16'[/code][/QUOTE] You are trying to build a Win 32 GUI program and you have no WinMain(...) - hence the error. If you want to build a GUI program, then write the WinMain(...) too, see [url]http://msdn.microsoft.com/en-us/library/ms633559.aspx[/url] Otherwise, start …

Member Avatar for tesuji
0
171
Member Avatar for Ellisande

How about adding a new member function, say SetStats(), which takes the user's choice and initializes a default constructed Character, i.e. [code] // default constructed Character player; cout <<"\n\nBefore we begin, please select your class." <<"\nEnter a 'W' for Warrior or an 'M' for Mage. "; char classChoice; cin >> …

Member Avatar for Ellisande
0
127
Member Avatar for Sniperx

[QUOTE=Sniperx;631847]it doesnt move through.. i does the same as my first one, just displaying only the second name now[/QUOTE] To loop through all the 12 names, you can use ... [code] for(int ii = [B][COLOR="Red"]0[/COLOR][/B]; ii < sizeof(names)/sizeof(names[0]); ++ii) { cout << "player: " << names[ii] << endl; } [/code] …

Member Avatar for Ancient Dragon
-1
181
Member Avatar for dougy83

Try changing '\r' to '\n' i.e. [code] send("telnet 192.168.3.100[B][COLOR="Green"]\n[/COLOR][/B]", 150); [/code]

Member Avatar for dougy83
0
277
Member Avatar for kux

[QUOTE=kux;631274]What i want to do is write some of the rows of a report style CListCtrl with a color and other rows with another color, but if I switch the color with SetTextColor the color of the text in the entire control switches, i want it to switch just for …

Member Avatar for mitrmkar
0
156
Member Avatar for perito

Post the complete code you have. If it is large, zip it and attach the zipped file.

Member Avatar for perito
0
115
Member Avatar for zoner7

[QUOTE=zoner7;630743]What in the world does line 20 do?[/QUOTE] A tutorial on it ... [url]http://www.cprogramming.com/tutorial/initialization-lists-c++.html[/url]

Member Avatar for ff4930
0
88
Member Avatar for moe3ius

A .PDF reader / outperforms Adobe's Reader big time (free) Foxit Reader [url]www.foxitsoftware.com[/url] A collection of Windows troubleshooting/monitoring tools (free) Sysinternals Suite [url]http://technet.microsoft.com/en-us/sysinternals/0e18b180-9b7a-4c49-8120-c47c5a693683.aspx[/url]

Member Avatar for sreein1986
0
191
Member Avatar for mrboolf

[ICODE]a[/ICODE] gets a negative value (-1) in the following loop. [code] // checks diagonal up-right movement for(a=i-1,b=j+1;a>=0, b<N;a--,b++) { if(board[a][b]==1) { [/code] The comma operator [ICODE]a>=0[COLOR="Red"],[/COLOR] b<N[/ICODE] is not doing what you probably expect.

Member Avatar for mrboolf
0
207
Member Avatar for hacker9801

[QUOTE=hacker9801;631161]If you use the new operator on a class, say [code=c++]class dummy { public: string f; }; int main(int argc, char *argv[]) { dummy *p = new dummy; return 0; }[/code] do you have to use the delete operator on [icode]p[/icode]? (since, apparently, it utilizes new.)[/QUOTE] Yes, when you want …

Member Avatar for hacker9801
0
91
Member Avatar for sambafriends

[QUOTE=sambafriends;623259]Thank u very much for this, Why we are putting getchar() again If it is not what happening there please give me reason[/QUOTE] Let's say you type in one letter 'a' and press Enter, at that point, in the input buffer are [B]two[/B] characters, the letter 'a' plus the newline …

Member Avatar for manavsm
0
163
Member Avatar for Alex Edwards

[QUOTE=Alex Edwards;630614]I have no way to tell if there is a memory leak or not during run-time. [/QUOTE] One basic detector (covers malloc/new) can be found e.g. here [url]http://www.codeproject.com/KB/applications/visualleakdetector.aspx[/url] and google finds more ...

Member Avatar for mitrmkar
0
115
Member Avatar for kux

[QUOTE=kux;630611]Is there any way of getting the selected date in a CDateTimeCtrl in a CString or char* or anyting?[/QUOTE] Here is one way .. [code] CTime time; if (GDT_VALID == DateTimeCtrl.GetTime(time)) { CString strDate = time.Format("%d.%m.%Y"); } [/code] See the CTime::Format(...) for more information on the the formatting options

Member Avatar for mitrmkar
0
99
Member Avatar for cb02061

[QUOTE=cb02061;630209] I got assertion failure error... [/QUOTE] Can you tell which ASSERT fails?

Member Avatar for mitrmkar
0
164
Member Avatar for Thew

[QUOTE=Thew;629971]I tried to delete all the struct definitions and start over. I found when I use SceneParticulation, the error will be raised. Otherwise everything goes ok. But what's wrong in this definition: [CODE] struct SceneParticulation { public: SceneParticulation(){}; ~SceneParticulation(){}; // here the program stops and fails ParticleSystem SPParticle; }; [/CODE][/QUOTE] …

Member Avatar for Thew
0
149
Member Avatar for Nemoticchigga

You might use std::string ... [CODE] string data; string line; while (getline(indata, line)) { data += line + '\n'; } [/CODE]

Member Avatar for Lerner
0
114
Member Avatar for Alex Edwards

[QUOTE=Alex Edwards;628077]If I use the [] operator and return a reference, is there any way to mark that indice when a value is assigned to it? [/QUOTE] Maybe you could use a bitset for tracking the assignments. Two things I noticed: - use of realloc() would result in fewer malloc/free …

Member Avatar for Radical Edward
0
214
Member Avatar for Traicey

[QUOTE=Traicey;628319]Such as.............[/QUOTE] You might post the relevant code, so we could see where it goes wrong.

Member Avatar for Ancient Dragon
0
127
Member Avatar for TacklesMcCaw

[QUOTE=TacklesMcCaw;627705]what advantage they would get from it.[/QUOTE] To avoid name (identifier) clashes.

Member Avatar for TacklesMcCaw
0
154
Member Avatar for Alex Edwards

After a quick look into it, I suggest that you get rid of malloc() usage. You are using 'delete' on memory that has been malloc'ed - that must not happen. Then about 'delete', you only can delete something that has been allocated by 'new', consider [code] class a { public: …

Member Avatar for Alex Edwards
0
163
Member Avatar for Alex Edwards

Emphasizing line #48, the [ICODE]mc[/ICODE] object is on stack (i.e. not allocated by new), so when it goes out of scope, its destructor gets called automatically. Generally you don't call destructors, those get called via delete or automatically in case of stack objects.

Member Avatar for Alex Edwards
0
75
Member Avatar for sniper29

Perhaps ... [CODE] double indexLowTemp() {ind=1; for (a=0;a<col;a++) {if (low<=temp[a][0]) {low=temp[a][0]; ind=a; } } [COLOR="Green"]// output low temp ... cout << low;[/COLOR] [/CODE]

Member Avatar for mitrmkar
0
49
Member Avatar for 007tron

[QUOTE=007tron;627776]that smiley not meant to be there[/QUOTE] FYI, there is the 'Disable smilies in text' option below the 'Submit Reply' button ... ;)

Member Avatar for VernonDozier
0
106
Member Avatar for 007tron

[QUOTE=007tron;627195]Anyone got anything?[/QUOTE] There is one 'oddity' that needs to be pointed out, namely usage of '\' as end-of-comment marker. The backslash at the end of the single line comment works as a line continuation character and hence the next line is also taken as comment. You have one instance …

Member Avatar for VernonDozier
0
231
Member Avatar for barnes138

Please use code tags when posting code, see here [url]http://www.daniweb.com/forums/misc-explaincode.html[/url]

Member Avatar for stephen84s
0
164
Member Avatar for FTProtocol

[QUOTE=FTProtocol;627254]do you have any clue on the function lol?[/QUOTE] You might try FlashWindow() or FlashWindowEx().

Member Avatar for Ancient Dragon
0
91
Member Avatar for Cybulski

Most probably the problems are not about security attributes but about you not using threads. Ancient Dragon made a good point above. Think what would happen if the wait call would block when you are doing it from the same thread that created the mutex in the first place (and …

Member Avatar for Ancient Dragon
0
583
Member Avatar for henpecked1

[QUOTE=henpecked1;627101] I can't for the life of me figure out the implementation of those virtuals though, nothing I put in outputs anything from main except 172, 173, 177, 181, and 185. I need to figure out how to make it see the other lines as "inputs" to those functions and …

Member Avatar for henpecked1
0
127
Member Avatar for imtnan

Two short tutorials [url]http://www.cplusplus.com/doc/tutorial/arrays.html[/url] [url]http://www.cplusplus.com/doc/tutorial/pointers.html[/url]

Member Avatar for dougy83
0
3K
Member Avatar for henpecked1

Two simple examples, hopefully you'll get something figured out of those ... [code]class a { public: a(string s1, string s2){} }; class b : public a { public: // default ctor b() : a("", "") {} // ctor with 4 strings b(string as1, string as2, string bs1, string bs2) : …

Member Avatar for henpecked1
0
174
Member Avatar for sniper29

[QUOTE=sniper29;626825]when i input rows and column.... the print result are all X...[/QUOTE] I gave it a try and there is one 'X' rest being '*'. [code] // output was after userinput Airplane Seat Assignment ****** *[COLOR="Green"][B]X[/B][/COLOR]**** ****** ****** ****** ****** ****** ****** ****** ****** ****** ****** ****** [/code] I.e. the …

Member Avatar for jephthah
0
405
Member Avatar for Cybulski

[QUOTE=Cybulski;625903]Now parameter 4: it should be &adress of this string, amirite?[/QUOTE] Basically a pointer (cast to void *) to anything you want the thread routine to receive via p_pVoid argument.

Member Avatar for Cybulski
0
880
Member Avatar for ice661666

[QUOTE=tesuji;625881]The poor problem is that neither printf nor cout of M$ visual c++ is able to print out long double values![/QUOTE] Surprisingly, at some point M$ dropped support for 80 bit long double, nowadays long double and double are equivalent (64 bits) (although distinct types).

Member Avatar for tesuji
0
139
Member Avatar for Phan

[QUOTE=Phan;626078] anytime when I call a function, it says that the function being called does not take 0 parameters? What does this mean?[/QUOTE] It means that you simply need to supply one or more parameters to the function, depending on how that functions defined. [code] // you must pass one …

Member Avatar for mitrmkar
0
132
Member Avatar for amarhp

[QUOTE=amarhp;624958]Thank you for reply... but my question is different.. my pointer is void pointer(void *) and it may be RAW data..it could be anything. but sure tht it is not string. waiting 4 reply..[/QUOTE] Like Edward already showed, you need to know the size of the memory block to copy, …

Member Avatar for Radical Edward
0
84
Member Avatar for somename

[CODE]int myfunction(int argc, char *argv[]){ int i; for(i=0;i<argc;i++) unlink(argv[i]); } int main(){ int argc; // argc is not initialized to any value, what might be its value here ?? char **argv; // argv is not initialized to any value, what might be its value here ?? // Now you call …

Member Avatar for LouPascalou
0
98
Member Avatar for Dannyo329

[QUOTE=Dannyo329;625133]Yeah, Thats exactly what I want, but how do you link the object files together to make a single executable program? And when I tried making the two files, and putting the code on to them, it didn't work. Thanx[/QUOTE] What compiler are you using?

Member Avatar for mitrmkar
0
122
Member Avatar for n00b3

[QUOTE=n00b3;625680] I have two basic questions. 1) Why can I not include fstream and/or string headers in my gui project? 2) Why can I not instantiate variables outside of the WindowProcedure or the WinMain functions? [/QUOTE] [code] #include <windows.h> #include <iostream> #include <fstream> #include <string> #include "my.cpp" // since fstream …

Member Avatar for mitrmkar
0
162
Member Avatar for bookworm619

Some more corrections in [COLOR="Red"]red[/COLOR] ... [code] /*------------------------------------------------------------------ * Assignment 7: FIRST LINKED LIST ASSIGNMENT. *Worth: 50 points *Made by: Samuel Georgeo (max11) create an in-memory SERIALLY linked-list database program which displays a menu screen. -------------------------------------------------------------------*/ #include <stdio.h> #include <iostream> #include "/var2/local/include/getch.h" using namespace std ; /*----------------------------------------------------- * MAIN PROGRAM …

Member Avatar for mitrmkar
0
417
Member Avatar for paolomontero

Have you tried Vintage Computer Forums? [url]http://www.vintage-computer.com/vcforum/index.php[/url]

Member Avatar for paolomontero
0
225
Member Avatar for champnim

[QUOTE=champnim;624325]I have a string of the form "abcd\"1234\"efgh". I want to extract 1234 from this string. How should I do this?[/QUOTE] You might use strtok(), see [url]http://www.cplusplus.com/reference/clibrary/cstring/strtok.html[/url]

Member Avatar for WaltP
0
282
Member Avatar for timbo2000

[QUOTE=timbo2000;625497]Im using visual studio 2005 on XP and am recieving an error in my program that looks as if the call is not matching what is in my lib. I have been doing some reading about the code generation phase of the compiler and find that I should look at …

Member Avatar for mitrmkar
0
95
Member Avatar for cam9856

[QUOTE=cam9856;625182]the code is updated i just need my question answered, anyone?[/QUOTE] Assuming that "the game just shuts down" still is the question, it is best if you post the updated code, so it can be given a test ride.

Member Avatar for cam9856
0
103
Member Avatar for SwathiSangral

[QUOTE=SwathiSangral;625085] In the .cpp file I have declared a object to the class as: [ICODE]CSafePtr<int> myobject(int* t);[/ICODE] [/QUOTE] The compiler actually sees that as a function prototype, i.e. a function named myobject, taking an int pointer and returning CSafePtr<int>. So, you'd need to change it as stephen84s already pointed out. …

Member Avatar for Radical Edward
0
126
Member Avatar for FTProtocol

I have to ask you, what is the following line supposed to do? [icode]HWND inputB = GetDlgItem(hWndDlg,(GetWindowText(input,NULL,NULL)));[/icode] The following will not work, 'inputB' is a window handle, not a pointer to a char array. [icode]SetWindowText(edit,(const char *)inputB);[/icode] You need ... [code] char text[SOME_SIZE] = {0}; // ... code that sets …

Member Avatar for FTProtocol
0
124
Member Avatar for herms14

About the if/else usage [code] if( array[j]==key){ search=search + 1; success= success + 1; } else if(array[j] !=key){ search=search + 1; success=success; } [/code] You can change it to [code] if( array[j]==key){ search=search + 1; success= success + 1; } else{ // here you already know that array[j] != key …

Member Avatar for mitrmkar
0
111
Member Avatar for c++noobie

A couple of things, get rid of the eof() in the while() loop, instead use [CODE] int format_file(string filename) { ... while (getline(readfile, line)) { ... } } [/CODE] If 'line' contains only whitespace, then the following will crash because [icode]line.length()-1[/icode] will be negative [CODE] //check for trailing spaces while …

Member Avatar for c++noobie
0
196

The End.