1,118 Posted Topics
Re: length() returns the number of elements in an array. low() returns the index of the first element. high() returns the index of the last element. setLength() changes the size of a dynamic array. [code=Delphi] var xs: array of integer; cntr: integer; begin setLength( xs, 5 ); writeln( 'Please enter ', … | |
Re: Not every possible flavor necessarily compiles using the default build process. You are trying to link with the regex library that has the following features: - multithreading support - using debug versions of the standard and runtime support libraries If your application doesn't use multithreading, you don't need the -mt- … | |
Re: No. A window must be visibe to be active (i.e. in order to receive user input events). Even though the window is inactive, your application is still running though, and can receive other events. You can set a system hook to capture events you are interested in, using SetWindowsHookEx(). System-wide … | |
Re: You have failed to use the proper directives to organize your code and data. Please read TASM's documentation. I should note also that you've got some pretty egregious errors there, particularly when [B]call[/B]ing and not [B]ret[/B]urning. Hope this helps. | |
Re: Merging always implies some sort of collation. The idea is not to append/connect then sort, but rather to sort at the same time as you connect them together. A naive but robust method would be to take each node from list B and insert it into list A in its … | |
Re: You'll need a temporary string (ASCIIZ) at least 260 bytes long (260 is a Windows thing). First copy the directory name to the string. Then concatenate a "\", then concatenate the filename. Use the temporary to name the file in your copy/open function. Hope this helps. | |
Re: The stuff on the net should generally work just fine. You might have troubles using components written for D3 or earlier, but most of the stuff I've seen out there are good for at least D4. A DPK file is how people usually distribute stuff for Delphi. In the help … | |
Re: You misunderstand something about pointers. "temp" is an array of 80 characters. There is now space reserved in memory for 80 characters. The name "temp" by itself is a pointer to the first character in the array. "array" is an array of 255 [I]pointers[/I] to characters. There is now space … | |
Re: As this is C++, you should be parsing each record using a stringstream and getline(). Here's [I]minimal[/I] code to get you started. [code=C++] string record, field; getline( cin, record ); { stringstream fields( record ); for ( int field_index = 0; getline( fields, field, '|' ); field_index++ ) store_field( field_index, … | |
Re: Destructively or non-destructively? Why do you have so much indirection? | |
Re: You may not like my saying, but those are pretty stupid restrictions. Your program is going to be pretty boring. Is there some reason you don't want to use more than five lines? | |
Re: You are looking at a not-so-great attempt at creating an application mutex. There is no OS support for such a thing in *nix, so the traditional way to do it is to create a "lock file", hence the flags (particlularly O_EXCL, or 'exclusive access'). A better algorithm is [URL="http://www.linuxquestions.org/questions/programming-9/restricting-multiple-instance-of-a-program-242069/"]here[/URL], as … | |
Re: Even experienced people are a little intimidated when they see a lot of class code or the like. It isn't a simple question. You are asking for someone to take a little while to completely analyze your code, rather than deal with a specific question. Your bubble sort looks fine … | |
Re: Originally, you had an integer, which we used as an index into a table of ASCII values. Basically, we said: [inlinecode]output_char = ascii_values[ input_index ];[/inlinecode] Now you want to go the other way --that is, convert the ASCII value into an index into the table. That's where scasb comes in. … | |
Re: Just create a utility function to get the number. When your program starts, call the function. When you press the button, an event method (onClick) gets called. Inside Button1Click just call the function again. Alas, for errors, it is usually simple enough just to write the [inlinecode]messageBox( ... )[/inlinecode] stuff … | |
Re: You are doing this in [I]assembly[/I]? The answer is "it depends." It depends on how you have structured your program to work. At the most basic, simply keep a string (a memory buffer) somewhere that stores characters input from the socket. When you are ready to print, just print the … | |
Re: Don't feel too bad. People post system() stuff all the time. Other than using "cls" or "clear" in a homework assignment, there are always better ways to do things than by using system(). One of the main problems with it is it is a security hole in your program --even … | |
Re: Was the help in [URL="http://www.daniweb.com/forums/thread100417.html"]this thread[/URL] not good enough for you? | |
Re: That's not really enough information for us to help you. C++ (and C) don't do graphics. What libraries are you using? What do you mean by "image"? Stuff on disk? Something in memory? ImageMagick is a good library solution if you don't already have something else going. | |
Re: If you are doing a game, [I]don't[/I] use system("cls"). Write it properly. What OS are you using? Windows? Linux? | |
Re: How are you displaying your text? (Rich Edit? Something you made? Console?) ![]() | |
Re: I'm not sure exactly what problems you are having, but the stuff following B4 has some errors. First, if you only want to clear the top two bits of AL then [inlinecode]shl al, [COLOR="Red"][B]2[/B][/COLOR][/inlinecode] [inlinecode]shr al, 2[/inlinecode] Or, even simpler: [inlinecode]and al, 3Fh[/inlinecode] Also, you only add 61 to it … | |
Re: Yes, good job. The only question is: how can you tell the difference between a node that contains a number and a node that contains an operator? (Have you learned about variant records?) Also, is it possible that the numbers in the equation will ever have fractional parts? (Say, what … | |
Re: I didn't think anyone was still looking at this problem. I'll pack up my example code for you. (It isn't finished as far as syntax highlighting is concerned, but it does everything with the system tray that you are trying to do. I'll PM it a little later today. For … | |
Re: You need the [B]cvt.s.w[/B] and [B]cvt.w.s[/B] instructions. If you don't have a reference, here's a PDF for you: [URL="www.uni-koblenz.de/~avolk/MIPS/Material/MIPSFloatingPointInstructions.pdf"]MIPS - Floating Point Instructions[/URL]. Hope this helps. | |
Re: It's probably in your [inlinecode]while (status != EOF || status2 != EOF)[/inlinecode] statement. That [inlinecode]||[/inlinecode] should be an [inlinecode]&&[/inlinecode]. Oh yeah, don't [inlinecode]int main(void)[/inlinecode]. Always use either: 1. [inlinecode]int main()[/inlinecode] 2. [inlinecode]int main( int argc, char *argv[] )[/inlinecode] Main takes arguments. If you want to ignore them, use form 1 … | |
Re: There's nothing wrong with saving a record directly to file like he does. All it means is that he only needs to dink with one thing at a time in the file instead of many. In fact, that's the whole point behind a record. There are a number of organizational … | |
Re: The file [B]QBASIC.HLP[/B] is not a Windows Help file, so WinHelp cannot open it. You need a program named [B]HELP.COM[/B]. If you google [B]olddos.exe[/B] you should find the Microsoft package that contains QBasic and other utilities, like Help.com. Hope this helps (pun intended) :icon_lol: | |
![]() | |
Re: Or you could just turn off the skipws flag: [inlinecode]while (input >> noskipws >> next)[/inlinecode] | |
Re: Try [URL="http://www.google.com/search?q=nintendo+ds+programming&afid=5052&s=&search="]Google[/URL]. The first link looks to have promising information. Also, even though you aren't writing a game, this kind of question might be better answered in the Game Development forum. Hope this helps. | |
Re: At this point we'll need to see your code to understand how you are trying to do things... ![]() | |
Re: You are having problems dealing with pointers. I know this sounds stupid, but you need to get out a piece of paper and [I]draw[/I] yourself a linked list, with little arrows pointing from element to element. Something else that might help you is to use references instead of pointers when … | |
Re: There's a limit to how big your data structures can be. Since MAX is 10,000 you are asking for an array of 10,000 x 10,000 x sizeof( int ) bytes which is likely about 400,000,000 bytes, which is nearly a half a Gigabyte! Either make a smaller array, or google … | |
Re: Not that I know of, but you could probably roll your own pretty easily. I know there are a lot of libraries people wrote on Google as well... How complex is the INI file you want to read? (Does it stick to the simple [inlinecode][this is a section header][/inlinecode] [inlinecode]this=is … | |
Re: You need to count how many lines there are. Every time you read '\n' from the file, increment your current line number and print it to the file. Hope this helps. | |
Re: Besides the obvious [B]solution[/B][EDIT][B]s[/B][/EDIT] I gave you, I don't see any way to do it without playing with the preprocessor (which, to my mind, is actually messing with more than one character...) Well, my blinders are intact... | |
Re: The stack is just a piece of memory where you can [I]push[/I] values on the end or [I]pop[/I] values from the end. The $sp register always points to the [I]next[/I] available spot. Visually: [code] [ ] [ ] [ ] <-- $sp [-7] [12] [/code] If we push 42 onto … | |
Re: The SetLength should not be in the loop, but after it. Other than that it looks fine to me. BTW. You should be able to replace lines 27..29 with just [inlinecode]records[j] := records[j+1];[/inlinecode] Don't know why you are using all-caps keywords, but it sure is anachronistic (a hold-over from brain-damaged … | |
Re: I think the OP is trying to do something that is way over his head right now. HTML is a [I]markup language[/I]. Your web browser or IDE (or both) must know how to read and display it to use it. It also sounds to me like you are trying to … | |
Re: Here's some desperate help: If I understand your problem correctly, you must get two numbers from the user, x1 and x2, then make an array (or [I]vector[/I]) of values from x1 to x2 inclusive? PCSpim is neither a compiler nor a proper assembler. It is a simulator for a virtual … | |
Re: Scheme (and other functional languages) don't look or work the same way as imperative languages like C. There is no such thing as [inlinecode](return [I]anything[/I])[/inlinecode] in Scheme. A lambda always looks the same way: [inlinecode]([B]lambda[/B] [I]arg-list[/I] [I]body-sexpr[/I])[/inlinecode] So a function that, say, adds two numbers looks like: [inlinecode](lambda (a b) … | |
Re: It is easy enough to write something that works with std::string. [code=C++] std::string GetFileTitle( std::string filename ) { std::string result; short len = GetFileTitle( filename.c_str(), NULL, 0 ); if (len < 0) throw 1; result.resize( len -1, '\0' ); if (!GetFileTitle( filename.c_str(), const_cast<char *>( result.c_str() ), len )) throw 1; … | |
Re: First off, your response has nothing to do with the OP's problem. Secondly, don't resurrect two year old threads unless you have something amazingly earthshaking to contribute. | |
Re: The [inlinecode]#include "filename"[/inlinecode] directive effectively works by directly inserting the named file into the text. [code=C++] // z.h int i; [/code] [code=C++] // z.cpp #include "z.h" [/code] [code=C++] // main.cpp #include "z.h" int main() { i = 42; return 0; } [/code] Is the same as: [code=C++] // z.cpp int … | |
Re: I've never needed to play with wav files myself, so I know nothing about it. However, you could easily have [URL="http://www.borg.com/~jglatt/tech/wave.htm"]googled this[/URL]. Hope this helps. | |
Re: No, you'd have to roll your own. Try googling for "delphi barchart component". If that doesn't help, I'll see if I can whip-up something simple for you. An edit component isn't going to display anything but text. | |
Re: Yes, you can do it in a loop. The trick is making things line up nicely. For this kind of exercise, I usually find it best to get out a piece of graph paper and decide where each character in the output should be. I notice you are using the … | |
Re: First, don't say [inlinecode]ios::in[/inlinecode]. It is implied by the type of stream you are opening. Second, [B]getline()[/B] isn't defined on [I]output[/I] files. Hope this helps. |
The End.