1,174 Posted Topics

Member Avatar for code zombie

Inside the class declaration is a typo, change to .. [code] template<class T3, class T4> friend std::ostream & operator<<(std::ostream& os, const TwoThings<T3, T4[COLOR="Red"]>[/COLOR] &); [/code] And then the definition without the scope resolution operator [code] template<class T3, class T4> std::ostream & operator<<(std::ostream & os, const TwoThings<T3, T4> & tt) { …

Member Avatar for mitrmkar
0
129
Member Avatar for lionaneesh

>> please tell me if there are any bugs in this program Hmm, maybe read [URL="http://www.catb.org/~esr/faqs/smart-questions.html#code"]When asking about code[/URL].

Member Avatar for Ancient Dragon
0
120
Member Avatar for kira_

[QUOTE=kira_;1172065]I have actually declared "word" as char in my actual program.. I just forgot to include it here... [/QUOTE] So are you saying that you have declared .. [code] char word; [/code] i.e. NOT .. [code] char word[some size here]; [/code] ? PS. You still 'forgot' to [I]include[/I] it.

Member Avatar for mitrmkar
0
106
Member Avatar for pinsickle

Here's a version with some [ICODE]assert()[/ICODE] added. Run it in the debugger and you'll probably be spotting errors quite quickly. [code] #include <cassert> void Array::merge (int first, int last) { const int arr_size = last-first+1; int* merged = new int[arr_size]; int mid = (first + last) / 2; int secList …

Member Avatar for mitrmkar
0
83
Member Avatar for tarheelfan_08

[QUOTE=tarheelfan_08;1172696]How would I make a change to a year or something in this vector[/QUOTE] See [URL="http://www.cplusplus.com/reference/stl/vector/operator%5B%5D/"]vector::operator[][/URL]. At the bottom of that page are links to other vector accessors. Also you might use iterators, also explained there. >> and print it for the user?? You are doing it already .. [code] …

Member Avatar for mitrmkar
0
382
Member Avatar for RandyWhite

[QUOTE=RandyWhite;1171968]... load and display images. After using the program for a while loading and displaying images then all of a sudden all the windows on the desktop disappear including the task bar on the bottom...[/QUOTE] This sounds very much like you are leaking GDI objects. That is, you are not …

Member Avatar for mitrmkar
0
120
Member Avatar for dondajr

[QUOTE=dondajr;1172035] Then sscanf separte the first and second putting on p1 and p2 char, the rest is ignored. [/QUOTE] GCC (hint) disagrees with you .. [code] warning: [I]too few arguments[/I] for format [/code] To ignore the rest, you might use .. [code] sscanf(data, "%[^':']:%[^':']:%*s", p1, p2); [/code]

Member Avatar for dondajr
0
90
Member Avatar for Pynolathgeen

[QUOTE=Pynolathgeen;1170156]where this is coming from?[/QUOTE] The runtime code calls [URL="http://msdn.microsoft.com/en-us/library/k089yyh0(VS.80).aspx"]abort()[/URL] (or perhaps even your own code?). Which compiler/IDE/OS you are using?

Member Avatar for Pynolathgeen
0
115
Member Avatar for Violet_82

[QUOTE=Violet_82;1170835] -the new project is now running so I choose File, New, File and then choose C++File in the menu, then ok [/QUOTE] You still need to add the new file to the project, do that via Project / Add Existing Item and select your new file. Or alternatively you …

Member Avatar for Violet_82
0
167
Member Avatar for josolanes

[QUOTE=josolanes;1170750] I tried to emulate a wrong filename by simply commenting out the header file and I got a much longer list of errors, including "Month thisMonth" being invalid so it seems to be finding the header file ok (as the error goes away when 'include "dateimpl.h"' is uncommendted out[/QUOTE] …

Member Avatar for mitrmkar
0
137
Member Avatar for dinamit875

[QUOTE=dinamit875;1170266]but still number "2" in menu crashes...i think i am having problem with displaying content of the file.[/QUOTE] You are not reading from the file anything. So, it will likely turn out to be an infinite loop there.

Member Avatar for mitrmkar
0
144
Member Avatar for una

[QUOTE=una;1170273]hi...can anyone give me the coding for the library management. I realy need that coding to my study. I need it A.S.A.P. Please...:([/QUOTE] Hi, Perhaps read; [URL="http://www.daniweb.com/forums/announcement8-2.html"]We only give homework help to those who show effort[/URL]

Member Avatar for mitrmkar
-2
110
Member Avatar for VilePlecenta

[QUOTE=VilePlecenta;1163908]Ah thanks the problem was the brush and the pens, I used [CODE]SelectObject( hdc, CreateSolidBrush( etc... ) );[/CODE] [/QUOTE] Seems like you have been leaking GDI objects. You might be interested in reading [URL="http://blogs.technet.com/markrussinovich/archive/2010/02/24/3315174.aspx"]Pushing the Limits of Windows: USER and GDI Objects – Part 1[/URL]. >> Another problem that Ive …

Member Avatar for VilePlecenta
1
115
Member Avatar for xavier666

Adding to what's already been said, line 125 is wrong, [ICODE]sizeof(array)[/ICODE] is equivalent to [ICODE]sizeof(int *)[/ICODE] there, so you have to know the correct array size there. "Establish The Size Of Array" could ensure that the given array size is reasonable and the allocation succeeds (e.g. now it accepts and …

Member Avatar for Banfa
0
652
Member Avatar for Stefano Mtangoo

>> But [I]even configure fails[/I]. This sounds too familiar to me .. I'd suggest that you try Cygwin instead of MSYS. I once failed to get GCC compiled on MSYS, but managed to get it done on Cygwin without too much of a hassle. On MSYS, the configure scripts simply …

Member Avatar for Stefano Mtangoo
0
469
Member Avatar for conkjj8

If you still have the following code .. [code] int n = 0; int* list = new(nothrow) int[n]; [/code] then you are thrashing memory (you'll get a pointer to a zero-sized memory block). So you need to re-think how to allocate the memory. Also make sure that the allocation succeeds …

Member Avatar for jonsca
3
310
Member Avatar for dabboo

[QUOTE=dabboo;1162163]I hit F9 key of my keyboard, the programme didn't run.[/QUOTE] On my Code::Blocks, F9 toggles a breakpoint. But to compile/link and run the program, you probably want to use F12. See the Code::Blocks' Build menu.

Member Avatar for dabboo
1
93
Member Avatar for dwdude

I think this is what you were after, note that you need an instance of the class through which you make the call ([ICODE]pB = new B;[/ICODE] below) [code] #include <iostream> struct B; struct A { B * pB; A(); ~A(); void func(int i, const char * p) { std::cout …

Member Avatar for dwdude
0
2K
Member Avatar for emilo35

[QUOTE=emilo35;1161877]I receive no warnings/errors during compile (using Dev-Cpp, WinXP) [/QUOTE] That is too hard to believe, given that you have there .. [code] FILE file = fopen(path, "rb"); [/code] So, could you verify that you are actually posting the relevant code?

Member Avatar for emilo35
0
290
Member Avatar for unbrknchane

[QUOTE=unbrknchane;1162048]well theres no error. lol....[/QUOTE] Consider getting a 'second opinion' by e.g. downloading and installing Code::Blocks (~15 MBs), i.e. you might get it up and running in no time. Then you might post back with what the new compiler is telling you.

Member Avatar for mitrmkar
0
153
Member Avatar for herrstarr

Line 59 is missing the ending semicolon, so .. [code] float number[COLOR="Red"] ;[/COLOR] [/code] Fixing that should take care of the first three errors. Note that the variable [ICODE]LENGTH[/ICODE] is OK as is, because it is [ICODE]const[/ICODE], so you don't have to change it in any way. [EDIT] As implied/suggested …

Member Avatar for mattjbond
0
133
Member Avatar for akssps011

Appears as if you are compiling it as C++ code instead of C. PS. When you post code snippets, try including everything relevant to the given piece of code/errors. I.e. in this case, you most likely are including <stdlib.h>, but that does not show in the snippet (even little things …

Member Avatar for akssps011
0
112
Member Avatar for coachkrzyzewski

[code] hashTable::hashTable(int size) { // A variable local to the constructor used here, // such vector object would be destroyed the moment // this constructor call is finished. //// vector<list<string> > theLists (size); // Instead use the member variable vector and // allocate the requested amount of lists ... theLists.resize(size); …

Member Avatar for mitrmkar
0
3K
Member Avatar for bgx90

[QUOTE=bgx90;1159709]Is "copy" used by the language in some way that prohibits its use as a variable name in this situation[/QUOTE] Yes it is, i.e. the [ICODE]std::copy[/ICODE] algorithm. It gets pulled in via [ICODE]using namespace std;[/ICODE]. So either change the name of the variable, or use your own namespace. [EDIT] PS. …

Member Avatar for bgx90
0
114
Member Avatar for Learning78

How about another approach where some functionality is enabled only when there is some user input? Maybe this would suit you better, if not, just discard this post. Anyways, that would look like .. [code] // in message map .. ON_EN_UPDATE(IDC_EDIT_CTRL, OnUpdateEdit) // Handler for EN_UPDATE void someDialog::OnUpdateEdit() { // …

Member Avatar for Learning78
0
2K
Member Avatar for endframe

Change the function's return type to [ICODE]void[/ICODE] and pass the third argument also as a pointer. (Though this first version that you have is more 'natural'/usable, i.e. it returns the calculated value.)

Member Avatar for BrianWren
0
234
Member Avatar for VilePlecenta

If your program is a regular GUI application, then you might consider using the code from [URL="http://msdn.microsoft.com/en-us/library/aa363215(VS.85).aspx"]Detecting Media Insertion or Removal[/URL]. I.e. not involving RegisterDeviceNotification() at all.

Member Avatar for VilePlecenta
0
205
Member Avatar for Galf

>> so I'm really just searching for the last occurrence of a slash or backslash. Have you considered [URL="http://www.cplusplus.com/reference/string/string/find_last_of/"]string::find_last_of()[/URL]?

Member Avatar for Galf
0
165
Member Avatar for i_luv_c++

[QUOTE=i_luv_c++;1155572]Still doesn't work I even tried to make second variable a string still doesn't work :([/QUOTE] OK, now [I]focus on[/I] your [ICODE]while()[/ICODE] loop's [I]exit condition[/I]. How does it actually work, given the way you have coded it?

Member Avatar for i_luv_c++
0
137
Member Avatar for oxy77
Member Avatar for marlowd

If you are the owner, you can still re-write the Dacl and recover that way. Also, you may resort to enabling the privileges SE_RESTORE_NAME and SE_BACKUP_NAME and you should be good to go (take ownership etc). A handy open source utility for you to study might be [URL="http://setacl.sourceforge.net/"]SetACL[/URL] PS. If …

Member Avatar for mitrmkar
0
100
Member Avatar for techie1991

[QUOTE=techie1991;1148424] Now, the problem I am facing is that when I read the file, I am shown the value two times. [/QUOTE] Simply don't use [ICODE].eof()[/ICODE] in the loop control, it does not work as you may think it does. Rather do.. [code] while (fr.read((char *) &s, sizeof s)) { …

Member Avatar for WaltP
0
481
Member Avatar for tom23

[QUOTE=tom23;1148395]In need a simple code that will check if proccesname is running, and if it does it terminate the c++ exefile, but if it dont it will continue to the code i want to run, can this be done?[/QUOTE] You might state the operating system that you are running.

Member Avatar for tom23
0
116
Member Avatar for 'AnKo

Have you thought about forgetting the char arrays and using [ICODE]std::string[/ICODE]instead? Consider for example [code] // Read in the line from data.txt, in one go string line; ifstream ifs("data.txt", ios::in | ios::binary); if(getline(ifs, line)) { cout << "read: " << line << endl; } [/code] But if you insist on …

Member Avatar for 'AnKo
0
324
Member Avatar for eddan

[QUOTE=eddan;1151330]Ill go ask in another forum, because I started yesterday and I want to know whats wrong, not that you should explain the basics. TY[/QUOTE] You really need to take a look into the basics, one basic -> [URL="http://www.learncpp.com/"]C++ Tutorial[/URL]. Perhaps start at Chapter 1, if you are interested in …

Member Avatar for mitrmkar
0
148
Member Avatar for Violet_82

[QUOTE=Violet_82;1145302] warning C4700: local variable 'myInstructions' [COLOR="Red"]used without having been initialized[/COLOR] [/QUOTE] Consider these warnings as [I]errors[/I] actually. If you don't fix these warnings (all of them), you will be in for surprises. And in general, pay attention to the compiler warnings, and don't ignore them.

Member Avatar for jonsca
0
157
Member Avatar for eddan

[QUOTE=eddan;1151200]Yeah I was stupid and pressed (X) on all of the bars to the left you know the "Solution Explorer" I think and alot of more, how do I re-enable them?[/QUOTE] Open the View menu, and select e.g. Solution Explorer, Class View and such.

Member Avatar for mitrmkar
0
92
Member Avatar for iNach

[QUOTE=iNach;1150747]Yeah, that helps, but I still want to know for my next programs, what to do if the text IS interactive...[/QUOTE] You can try to resort to the [ICODE]SetConsoleScreenBufferSize()[/ICODE] function, as suggested by nezachem. It is actually quite simple, so maybe try running the below code and see how it …

Member Avatar for mitrmkar
0
151
Member Avatar for ybkumar77

The error is quite obvious [code] char *compareFN=NULL; // 'compareFN' is a null pointer, strcpy() is guaranteed to fail strcpy(compareFN, ((*myPtr).second)-> getEmpFirstName()); [/code] So [ICODE]strcpy()[/ICODE] copies the source buffer to the destination [I]buffer[/I], which you don't have. In other words, you must have a char buffer sufficiently large to hold …

Member Avatar for ybkumar77
0
1K
Member Avatar for Kikazaru

This looks like undefined behaviour [QUOTE=Dratf Standard] 7.1.6.1 Except that any class member declared mutable (7.1.1) can be modified, any attempt to modify a const object during its lifetime (3.8) results in undefined behavior. Example: <snip> const int * ciq = new const int(3); // initialized as required int * …

Member Avatar for vijayan121
0
3K
Member Avatar for Nicholas_Roge

[QUOTE=Nicholas_Roge;1148817]Basically I'm asking how I can output pixels to the screen without using any of the default windows gui classes.[/QUOTE] It seems that you might want to create and use your own windows classes. Perhaps start by reading about [URL="http://msdn.microsoft.com/en-us/library/ms632596(VS.85).aspx"]Window Classes[/URL]. Or if you really just want to simply [I]output …

Member Avatar for Stefano Mtangoo
0
113
Member Avatar for Enigmatic331

What tkud already said ^^ and also if you can describe what's the purpose of this program and the red dot, then people might come up with suggestions.

Member Avatar for Enigmatic331
0
170
Member Avatar for DrewDodson89

[QUOTE=DrewDodson89;1150019]Also, I am having a hard time remembering how to make so I can use a function that is further down the program. Instead of it saying it is undefined[/QUOTE] You need the function prototype prior to its usage and the function definition later on. [code] // The prototype int …

Member Avatar for DrewDodson89
0
228
Member Avatar for eliza420

[QUOTE=techie1991;1147452] hte above code reads from the file a word of max length 15 and puts it into the string a. The line: f>>a, tells the compiler to read from file till a white space is encountered. For more info, go to: [URL="http://www.bgsu.edu/departments/compsci/docs/read.html"]http://www.bgsu.edu/departments/compsci/docs/read.html[/URL][/QUOTE] That is actually an example of a …

Member Avatar for Fbody
0
170
Member Avatar for liveshell

[QUOTE=liveshell;1148334]So is there any memory leak in bool CManager::GenerateResponseTagMap() ??[/QUOTE] It looks like a perfectly valid way of doing what you are doing there. However, you may be leaking [ICODE]CManager[/ICODE] object(s). So, how are you allocating those objects, also are you using [I]static[/I] [ICODE]CManager[/ICODE] objects?

Member Avatar for Salem
0
758
Member Avatar for iNach
Member Avatar for Salem
0
136
Member Avatar for react05

[QUOTE=react05;1147527]"no match for operator<' in' i<token' " [code] for(i=0;i < token; i++)[/code] 'push' undeclared [code]push(token[i]);[/code] 'pop' undeclared [code] value1 = pop( );[/code][/QUOTE] I think you meant to say .. [code] for(i=0;i < token.length(); i++)[/code] And for the other two errors, both [ICODE]pop()[/ICODE] and [ICODE]push()[/ICODE] are methods of the [ICODE]Stack[/ICODE] class …

Member Avatar for react05
0
205
Member Avatar for desperado85

[ICODE]CString::Format()[/ICODE] works like [ICODE]sprintf()[/ICODE], so you can do .. [code] CString data; CString data2 = _T("1200"); data.Format(_T("!64.8 Px.1= %s"), (LPCTSTR)data2); [/code]

Member Avatar for mitrmkar
0
97
Member Avatar for karolik

[QUOTE=karolik;1147898] Class Parser and in this class is constructor [CODE]Parser(string s){ // constructor }[/CODE][/QUOTE] [ICODE]Parser[/ICODE] constructor takes a temporary string, i.e. once the [ICODE]Parser[/ICODE] object is constructed, the [ICODE]string s[/ICODE] object is destructed, hence [ICODE]tokens[/ICODE] ends up pointing to deleted memory (i.e. garbage). You might pass the string in by …

Member Avatar for mitrmkar
0
109
Member Avatar for pato wlmc

[ICODE]AboutDlgProc[/ICODE] is the dialog procedure (a function) that will handle displaying your About dialog box. The compiler has not seen the [ICODE]AboutDlgProc()[/ICODE] function at the point where the error occurs. Do you have that function in that .cpp file?

Member Avatar for mitrmkar
0
579

The End.