- Strength to Increase Rep
- +15
- Strength to Decrease Rep
- -3
- Upvotes Received
- 178
- Posts with Upvotes
- 153
- Upvoting Members
- 94
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
- Interests
- programming, 3d modelling & animation, archery, martial-arts, reading, camping, hmm... what…
1,118 Posted Topics
Re: Typically the main icon is linked in at compilation. How exactly you do it depends on your compiler. In all cases, a Windows resource named MAINICON is in your exe. You can also check out [URL="http://angusj.com/resourcehacker/"]Resource Hacker[/URL], which you can use to manually change a program's icon. | |
Re: The best way to learn actually is to try to do it yourself. A good reference is always a very useful help. I refer to these two often: [URL="http://www.cppreference.com/"]C/C++ Reference[/URL] (short and sweet) [URL="http://www.cplusplus.com/"]cplusplus.com[/URL] (all the gory details) Start small, add on details as you go, and you'll be able … | |
Re: Since you are compiling with the [inlinecode]UNICODE[/inlinecode] flag, you must either indicate that string literals are wide-char directly: [inlinecode]L"Hello world!"[/inlinecode] or (better yet) use the [b]TEXT[/b]() macro: [inlinecode]PlaySound(TEXT("beep.wav"), 0, SND_LOOP|SND_ASYNC);[/inlinecode] Have fun. | |
Re: [URL="http://www.parashift.com/c++-faq-lite/templates.html"]http://www.parashift.com/c++-faq-lite/templates.html[/URL] | |
Re: You'll also improve your program's safety by using the [b]std::string[/b] type: [code=C++] #include <fstream> #include <iostream> #include <string> using namespace std; int main() { string filename; cout << "Name your file> "; getline( cin, filename ); fstream file( filename.c_str() ); if (!file) { cout << "I could not open the … | |
Re: Hey there, just a heads-up to let you know that help is forthcoming. I just had to go learn how to solve a linear system of equations using gaussian elimination and partial pivotization first. Now I'm looking over your code. I've got a few suggestions about commentary and variable names, … | |
Re: The TMediaPlayer component should be able to play with any codec installed on your computer. Can you play the file normally using Windows Media Player from Explorer? | |
Re: His question is why the rewritten stuff on Windows 7 works so much faster than what he had been using. @OP: You state that you are using `CopyFileEx()` (a Win API function) on Unix systems and it is going slow. Assuming your original code does not have any hooks on … | |
Re: I notice you are spamming the forum with a lot of questions that you could easily get the answer to by simply reading [the documentation](http://en.cppreference.com/w/) or simple searches on Google. What about my answer to [this same question](https://www.daniweb.com/software-development/c/threads/490534/c-preprocessor-directives) needs you to start another thread to ask it again? | |
Re: There is no exhaustive list, because each compiler system + OS has their own. There are common, standard ones, though. [Here's the GNU CPP's documentation.](https://gcc.gnu.org/onlinedocs/cpp/Index-of-Directives.html#Index-of-Directives) Hope this helps. | |
Re: Why are you subtracting 1 on line 11? | |
Re: Plenty of people still program with ancient, pre-standard compilers, particularly in places like India. Also, there does exist the [WinBGIm port](http://winbgim.codecutter.org/) for MinGW, so old BGI code certainly can and does compile with modern GCC. Alas, I am currently reinstalling my compiler (I managed to hose it with an 'automatic … | |
Re: No. All (normal) messages go to a window event handler. The functions you write to handle events can, of course, be as window agnostic as you like. | |
Re: Why is everyone trying to quicksort a linked list? | |
Re: I hesitate to link to another site for your answer, but your question about how to use `qsort()` is entirely answered in the FAQ [here](http://www.cplusplus.com/faq/sequences/sequencing/sort-stuff/#c). It explains how `qsort()` works and gives an example of randomizing data with it. That comparison function is the key to making it work. Hope … | |
Re: I'm confused. Are you talking about a circular buffer? | |
Re: I wish I could say. Richedit does have some random issues. 1) Make sure you are linking to the most current RichEdit DLL (4.1). 2) Make sure your window with the RichEdit control is *not* doublebuffered. 3) Make sure your manifest is correct. I assume you are using the RichEdit's … | |
Re: Is there something left out about the format of the data you are searching? There is no way to search *random* data faster than O(n). However, if your data were *sorted* then you could search it in O(log n). Also, every time you add extra code to do something the … | |
Re: stty is not the best option for this. You should first look to see if the environment variable $COLUMNS exists. It is most likely to be correct. Failing that, use the command `tput cols` to query the terminal size. If you really want to do it properly though you'll have … | |
Re: What you've got seems to introduce but not use 't', and has a bug on line 16 (when temp->next is NULL). Also, you are endeavoring to do two things at once: sort *and* display. Don't do that. Put the sort stuff in its own function. Sorting is not particularly easy, … | |
Re: To be clear, *no*, you *cannot* override static methods. (You can *overload* them, though.) The reason is simple: a static method cannot appear in a class's virtual function table, so it is not inherited. In order to call a static method you must know exactly what type of object you … | |
Re: Using a library and decoding an image yourself are two totally different things. The OP cannot change his compiler's environment, but there is never any restriction on the files you can create for a single-user directory (outside of diskspace, of course). Using CImg would work fine. (I know this is … | |
Re: That code is wrong in a number of subtle and dangerous ways. But what it is trying to do is write the binary value of a 'PasswordGenerator' object to file. Any object you wish to write should have a function to explicitly convert it to either text or binary. If … | |
Hey all. I'm always frustrated that I cannot seem to find a reference that shows when a feature was *introduced* in Delphi. For example, to use ErrOutput, I have to manually create that value in D5. But what about D6? or D7? Does such a reference exist? | |
Re: Apple is putting a lot of effort into LLVM. Unfortunately, the LLVM debugger doesn't work with FPC (yet, AFAIK). You'll either have to get an old copy of the GDB or install an older version of X-Code (you can do this side-by-side with your current version). Alas, I don't have … | |
Re: [B]scanf()[/B] and [B]cin[/B] tokenize on whitespace, so yes, they stop reading input at any whitespace. Please don't use gets(). [B]fgets()[/B] reads an entire line (it even returns the newline character at the end of the line), so if there are spaces in the line you'll get them too. The C++ … | |
Re: The best place to start is to get out a piece of paper and a pencil and figure out how you do it yourself. Once you know how to do it, step by step, you can tell the computer how to do it. When you have thought it out enough … | |
Re: IIRC, it worked just fine. You aren't seeing output because of the way Turbo C/C++ initializes the console output. The problem is that you are doing something wrong. Are you trying to get a directory listing? Or just show it to the user? | |
Re: The difference between an procedural and an object-oriented approach is how you bind the data and the functions that do something to it together. Right now you have a very good structure. You have [B]struct[/B]s that hold the data, and functions that operate on specific data. What you need to … | |
Re: ...and [inlinecode]main( void )[/inlinecode] is a C99 monstrosity. ![]() | |
Re: Nice, but it fails on three counts: 1. It doesn't return the new head of the list. 2. It fails if [B]h[/B] is NULL. 3. It fails on really big lists (stack overflow). Here's an iterative solution you might enjoy. [code=C] /* Reverse a singly linked list without recursion. The … | |
Re: The [B]windres[/B] program doesn't like pathnames with spaces in them. It is also possible that the Dev IDE is not properly quoting pathnames with spaces in them... but even if it does the windres program is surprisingly broken on this point. Sorry. | |
Re: In the DPR file before the main form is created, set the monitor to the one you want: [inlinecode]application.mainForm.monitor := screen.monitors[ 1 ];[/inlinecode] I've never done this before, nor have I ever had a dual-monitor system, so I can't say this will actually work... But I think it will. Hope … | |
Re: Sorry to say, no one here is going to give you code. Frankly, if you plan to write a report on how to improve code, you need to have a pretty good idea of how the code is generally implemented to begin with. You should be able to write it … | |
Re: Some repairs. [code=C] #include <stdio.h> #include <stdlib.h> int main() { int i ; i=system("dir"); printf("%d",i); getchar(); return 0; } [/code] This is correct. @[b]nezachem[/b] [b]system[/b]() expects either an executable or a shell builtin. The [b]system[/b]() function can fail for a number of reasons. Be sure to read the [URL="http://linux.die.net/man/3/system"]man page[/URL] … | |
Re: It isn't the code that's complaining, it is the linker ([B]ld[/B]). Most likely you are trying to write to a file that is read-only, or read or write a file that you don't have access rights to. Are you using linux? | |
Re: You'll need to use the [B][I]modulo[/I][/B] (or [B][I]remainder[/I][/B]) operator: [inlinecode][COLOR="Red"]%[/COLOR][/inlinecode] It does what it says: [inlinecode]cout << (123 % 10);[/inlinecode] Hope this helps. | |
Re: You've created a 2D array of (char*) (pointers to char), but you have not pointed them anywhere. Hence they are [URL="http://en.wikipedia.org/wiki/Dangling_pointer"][I]dangling pointers[/I][/URL], and will cause your program to crash. If you want a 1D array of strings (where a string is an array of char): [inlinecode]char names[ NUM_NAMES ][ MAX_NAME_LENGTH … | |
Re: Eh, why not? [B][[I][/I]code=C++[I][/I]][/B] [code=C++] switch (pnlCards.Tag) { case 0: result = prediction; break; case 1: case 2: case 3: case 4: case 5: TPanel p = (TPanel)(pnlCards.Controls[ pnlCards.Tag ]); TPanel p0 = (TPanel)(pnlCards.Controls[ pnlCards.Tag-1 ]); if (p.Tag > p0.Tag) result = higher; if (p.Tag < p0.Tag) result := lower; … | |
Re: I have never played directly with Qt stylesheets... but it appears that you need to provide an image for the indicator with the color you want. Here's what I found about it: [url]http://lists.trolltech.com/qt-interest/2006-11/thread00074-0.html[/url] The OP wants to manage different colors for different states, but the underlying problem is the same. … | |
Re: Show us what you can do and we'll help you where you get stuck. You will need a loop and two conditional checks to see if the letter needs to be converted to uppercase. I assume ASCII? | |
Re: Using the Win32 API, you need to: 1. CreateCompatibleDC to create a DC compatible with your window's DC 2. CreateCompatibleBitmap with the appropriate dimensions 3. SelectObject to select the window into the bitmap 4. BitBlt the window into the bitmap 5. Save the bitmap as Jpeg Hope this helps. | |
Re: The exact macro to test for depends on OS [i]and[/i] compiler. Here is a handy reference for [URL="http://predef.sourceforge.net/"][B]Pre-defined C/C++ Compiler Macros[/B][/URL]. Unless you have been careful to predefine specific macros in your makefiles as [b]AD[/b] instructed, you should test for all the possible macros that you might expect. On Windows, … | |
Re: I know this sounds funny, but you need to get out a piece of construction paper and some crayons and draw yourself a house. Then, using your finger, 'click' on the picture where the instructions say and in the order they say. For example, 1: click on lower-left corner of … | |
Re: The app doesn't restart -- it doesn't terminate until you drop off the end of the main() function. If you really want to clear the screen, [URL="http://support.microsoft.com/kb/q99261/"]this is how Microsoft does it[/URL]. Enjoy. | |
| |
Re: I don't know how you have your script set up, but the [Tasks] and [Components] sections are specifically designed for this. Every "task" you list in the tasks section indicates some component to install. The Inno Setup Help documentation is very complete, and gives examples. You have to stare at … | |
Re: [URL="http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html"][b]LINE_MAX[/b][/URL] is an IEEE extension to the standard [URL="http://www.cplusplus.com/reference/clibrary/climits/"]<limits.h>[/URL], found on some *nix systems. [b]TurboC[/b] does is older than, and does not follow, Open Group specifications. The proper way to do what you want is to use a stack-local variable: [code=C] #include <stdio.h> #include <string.h> #define MY_MAX 1000 int main() … | |
Re: In addition, you should have a [b]removeBook[/b]() (or some such named) method(s) for the user's convenience. | |
Re: It should also be noted, in addition to [b]StuXYZ[/b]'s excellent comments, that you should get an entire [b]Student[/b] before adding a copy of it to the vector. Your choice of variable names is pretty good, actually, but I will nit-pick about the vector name: "sNames" -- first, it isn't a … |
The End.