15,300 Posted Topics
Re: You don't call [b]new[/b] to allocate COM pointers. Call [URL="http://msdn.microsoft.com/en-us/library/ms686615%28VS.85%29.aspx"]CoCreateInstance[/URL]() | |
Re: I like the second example better, but delete line 14. Of course it won't work if you need to know the value of [b]m[/b] after the loop terminates. | |
Re: >>Examine this program? Tell me its bugs Well, all you have to do is run it several times and you will find out the bugs. | |
Re: The Ctrl+] key (same unshifted } key ) can be used to find matching { and }, ( and ) or [ and ]. Is that what you are talking about? | |
Re: Depends on whether its of type float or double. Floats are "%f" but doubles are "%lf". I think long doubles would be "llf", which is a little like long long int (64-bit integers). | |
Re: >>But it does not operate well. What exactly does that mean? lines 23-31: If the return value is -1 then the program prints an error message and continues to process as if the return value were ok ??? That's a little like when chopping an onion, you accidentally chop off … | |
Re: what operating system, what gui, what compiler ??? We need a whole lot more information that what you have provided. | |
Re: All you have to do is print the lines on the screen. You don't have to insert anything into the actual text. in a loop from 0 to length of line, print one character, increment a count. If the counter == maxlength, print '\n' and reset the counter back to … | |
Re: lines 26 and 36: >> for(x=1;x<265;x++) Why are you hard coding the number 265 here? Just read the file until end-of-file is reachec [code] while( x < 255 && fromfile.getline(question[x], 255) ) { ++x; } [/code] You would be better off using an array of std::string objects instead of those … | |
Re: Are you talking about the c language itself or console program window ? The problem has nothing to do with c language. Even if you run cmd.com to get a console window then maximize it, the window may not cover the entire monitor canvas, depending on the pixel settings you … | |
Re: Assuming the buffers contain binary, not string, data -- create a third buffer that is large enough to hold both the first and second buffers, e.g. [icode]char buf3[2048];[/icode] Then use memcpy() to copy each of the two original buffers into the third buffer. If the two buffers actually contain null-terminated … | |
Re: You have to be careful of lines like this: while(myStack->data[top]!='(') [b]top[/b] is not a variable, but a member of the STACK structure. So you need to write it like this: myStack->top. You have that same error several times. >>push(&myStack, symbol); variable myStack is already a pointer, so remove the & … | |
Re: you can execute other programs with the system() function or with several os-specific api functions. For MS-Windows it might be either ShellExecute() or CreateProcess(). | |
Re: You can't even install TC on MS-Windows version Vista or Win7. I tried it and it doesn't work. IMHO TurboC/C++ is a great compiler for hobbyists and teenagers or pre-teens. But in order to use it you must have an old version of MS-Windows or MS-DOS installed. Professional programmers wouldn't … | |
Re: post the file. Does one record consist of two or more lines in the file? If not, then why use %? | |
Re: The loop starting on line 31 does more than what is necessary. Just use subscripts into the two strings [code] for( int count = 0; count < key.length(); count++) { if( answers[count] == key[count] ) grade++; else cout << "Answer # " << count+1 << " is wrong\n"; } [/code] | |
Re: >>Filenames is the container I am using. What container? Post how Filenames is declared. Is it std::string, vector<string>, or something else? We need a lot more details about it in order for anyone to tell you how to serialize it. Assuming Filenames is a vector<string>, then do it something like … | |
Re: why? it's not necessary to null-terminate std::strings like it is with character arrays. As for the vector, its not necessary to null-terminate it either. If you want the number of strings in the vector then just call its size() method [icode]for(int i = 0; i < mylist.size(); i++)[/icode], or you … | |
Re: What makes you think Tomm Gunn is a guy? I know for a fact that Narue is female. So if Tomm is a guy then of course he and Narue could not possibly be the same person, unless you know of a guy who can have babies. | |
Re: >>Build: 0 succeeded, 0 failed, 1 up-to-date, 0 skipped That tells you that it did not generate an executable program. Did you save the source file after you created it? | |
Re: You need to study your textbook or google for online tutorials about linked lists. They will show you how to write functions to insert and delete nodes in the linked lists. | |
Re: You need to write GUI programs if you want to add sprites. The easiest way to do it is probably with OpenGL or DirectX libraries. >>Dev-C++ is what im running) Ditch it and install Code::Blocks with MinGW. Its a better IDE and supports current versions of g++ while Dev-C++ is … | |
Re: [URL="http://lmgtfy.com/?q=how+to+write+a+search+engine+in+c%2B%2B"]Start here.[/URL] But don't expect you will be productive for a few years. | |
Re: You can not declare objects in a header file without the [b]extern[/b] keyword. When you do it without that you will get the results you have because the objects will be defined in every *.cpp file in which the header file is included. Use [b]extern[/b] in header files. Then in … | |
Re: That's like saying "my car is broke. Anyone know how to fix it ?" Did you google for the error message? [URL="http://www.shirt-pocket.com/forums/archive/index.php/t-253.html"]Here [/URL]is one idea (running out of resources) | |
Re: I don't see any difference. But I did get 1,340,000 hits on [b]SERPS[/b] :sweat: | |
Re: Check the file system and see if the file actually exists. [quote]file has 0 characters, 0 words, and 0lines[/quote] Is that what you typed on the command line for the name of the file ???? | |
Re: To remove blank lines, just ignore them. Don't do anything with them. To remove trailing spaces: Set a pointer to the end of the character array, back up until the first non-white-space is found, then insert a string's null terminator at that point. For example, not that in the code … | |
Re: Is there any professional software being developed in India with Turbo C compiler? I surely hope not, but I have no way of knowing. | |
Re: [QUOTE=ayan2587;1169457]i have reversed the string here by recursion..[/quote] And what do you suppose will happen to your program if the original string has more than two characters? Hint: bomb! If that is supposed to be a c++ why did you use a character array instead of std::string to hold the … | |
Re: >>Is there a way to fix this? Probably. My [b]guess[/b] is that the program is not using the right brush color for painting. There are lots of ways to do that but the simplest might be to make the brush a global object so that it doesn't get destroyed between … | |
Re: [quote]this programe is giving compile error:- SEGMENTATION FAULT [/quote] No it isn't. A Seg fault is NOT a compiler error, but runtime error. The compiler has finished doing its job by the time you run the program. line 18: c[i] = (' '); Remove the { and }. You don't … | |
Re: functions have to be declared before they can be used. Put [icode]int Mainmenu();[/icode] somewhere near the top of the program (such as between lines 5 and 6). That is called a function prototype. | |
Re: Delete line 19 because the prototype on that line is probably not the same as the prototype found in string.h. Why prototype something twice ? | |
Re: I realize you put in a lot of time and effort writing/testing the program and you are probably hoping to make billions of dollars with it, but I think you might want to sell it as a shareware program and include the source code if someone actually registers the program … | |
Re: Assuming you mean MS-Windows operating system, call [URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/memory/base/globalmemorystatus.asp"]GlobalMemoryStatus[/URL]. | |
Re: Just a thought, but [URL="http://lmgtfy.com/?q=c+tutorial+for+joysticks"]this may help you[/URL] | |
Re: what compiler do you have ? You can get some old MS-DOS stuff [URL="http://www.codexxi.com/"]here[/URL]. They are not tutorials but actual working example programs. | |
Re: [QUOTE=cscgal;1164239]Hi :) At this time, we're only accepting tutorials that are unique content to DaniWeb, and not reproduced elsewhere on the web.[/QUOTE] And the result is that there is only ONE tutorial in the c++ forum. Is the reason that no one has submitted any tutorials, or is it that … | |
Re: The base class is where you would put pure virtual functions so that all derived classes have to implement them. Although the boat class may not have doors, then getNoOfDoors() would just return 0 so that the virtual function would be implemented in the derived class. | |
Re: >>please solve this question for me now.. No. Do it yourself. | |
Re: [QUOTE=g-company;1168791]Hello i want to retrive information of various fonts used in an RTF file.so that i can use it in my RichEditCtrl class.[/QUOTE] That's nice. And I want a million dollars. | |
Re: The easiest way to create binary files is to use fixed-length character arrays instead of std::string. That will make each of the records in the binary fine the same size and you can easily locate any record in the file by simply multiplying the record number times record size. [code] … | |
Re: No one knows everything about everything. IMO you will know you are a good programmer when your peers tell you that you are one. And that takes a lot of time and practice. Employers do not expect entry-level people to know a lot about programming. You should be able to … | |
Re: you need to download and install the Windows Platform SDK because that compiler is too old. Get it [URL="http://www.microsoft.com/downloads/details.aspx?FamilyId=E6E1C3DF-A74F-4207-8586-711EBE331CDC&displaylang=en"]here[/URL]. After installing the PSDK in the VC++ 6.0 IDE select Tools->Options->Directories and add the include and lib paths. | |
Re: where did you call popen() to open the pipe? [edit]Oh never mind. I checked the [URL="http://linux.die.net/man/2/pipe"]*nix man page [/URL]and it appears you did it the same way as in the example. Since I don't use *nix very often I have no clue what is wrong. [/edit] | |
Re: That sounds like the classic circular array. The way I did it was to have two counters. The first counter indicates the maximum number of strings that can be put into the array (e.g. the array's allocated amount). The second counter indicates the next insertion position [icode]int nextpos;[/icode] When nextpos … | |
Re: C, C++ and C# are all very similar languages, but also very different. Most of the concepts in C were used to create C++, and likewise most of the concepts of C++ were used to create C#. I agree with Myrtle that it may be better to lean one of … | |
Re: Does one thread depends on the results of the other thread? Or main() needs the results of the other two threads() ? Maybe you need to add a WaitForMultipleObjects() -- or something like that -- in main(). Without more detail its hard telling what is going on. To answer your … |
The End.