1,118 Posted Topics
Re: An AnsiString is a class, just like any other type of data. To modify it in a function, pass it by reference: [inlinecode]void myFunction( AnsiString &s )[/inlinecode] Hope this helps. | |
Re: I suggest you take a read through [URL="http://www.newty.de/fpt/"][B]The Function Pointer Tutorials[/B][/URL], particularly [URL="http://www.newty.de/fpt/fpt.html#r_value"][b]this one[/b][/URL]. I would use some [b]typedef[/b]s to help: [code=C] typedef float (char2float_t)( char ); typedef char2float_t* int2char2float_t( int ); ... char2float_t* wonky_function_1( int n ) { ... } ... int2char2float_t* fp1 = &wonky_function_1; char2float_t* fp2 = fp1( … | |
Re: If you have actually [b]fork[/b]()ed (or [b]spawn[/b]()ed) a child process, and you just want to check whether or not it has terminated, you want the [URL="http://linux.die.net/man/2/waitpid"][b]waitpid[/b]()[/URL] function. You can also use the [URL="http://linux.die.net/man/3/usleep"][b]usleep[/b]()[/URL] function to cause the parent to spin its wheels for a short bit. There are more modern … | |
Re: There is no simple answer. You might want to look through [URL="http://www.free-soft.org/guitool/"][b]The GUI Toolkit, Framework Page[/b][/URL]. [b]TrollTech Qt[/b] is a good choice if you can use it -- it has some powerful image handling capabilities. [b]GTK+[/b] is also a very good choice for image handling. IDE's like VB's are a … | |
Re: The first thing you need to do is break your dependence on the [b]system[/b]() function. It spawns a new shell (cmd.exe, probably), changes the directory for that new shell, then terminates. Your program's current working directory remains the same. Most C/C++ compilers provide versions of the <unistd.h> function [URL="http://linux.die.net/man/2/chdir"][b]chdir[/b]()[/URL]. You … | |
Re: You should read up on [b]virtual[/b] methods. [code=C++] class Greeting { public: // Here is our abstract, overridable method virtual std::string hello() const = 0; }; // Here is an example of how it is used class Saludo: public Greeting { public: std::string hello() const { return std::string("Buenos Dias"); } … | |
Re: Whitespace between the keyword [b]end[/b] and the period is not significant. Perhaps you should post more code? It is hard to diagnose what is wrong. With FPC, you must be sure to have the [inlinecode]{$goto on}[/inlinecode] directive enabled. I don't think that the $N directive is used in FPC -- … | |
Re: Standard C doesn't have anything to do with it. You need to modify the input stream's mode to "unbuffered". You probably want to turn off "echo" also. Both of these things are OS-dependent things to do. What OS are you targeting? | |
Re: The GCC does not supply [b]gotoxy[/b]() with <conio.h>. Since it is a Windows program, why not use the [URL="http://www.google.com/search?btnI=1&q=msdn+SetConsoleCursorPosition"][b]SetConsoleCursorPosition[/b]()[/URL] function? If you are using POSIX, let me know. | |
Re: It would, as [b]VernonDozier[/b] suggested, be easy enough to code your own version... Here's a simple stab at it: [code=C++] #include <iostream> #include <string> std::istream& getline( std::istream& ins, std::string& result, const std::string& terminator ) { char c; result.clear(); while (ins.get( c )) { result.push_back( c ); if (result.rfind( terminator ) … | |
Re: I suggest [URL="http://www.libsdl.org/"][b]SDL[/b][/URL]. Take a look through [URL="http://lazyfoo.net/SDL_tutorials/"][b]Lazy Foo' Productions[/b][/URL]'s tutorials to get started. There is also [URL="http://www.pygame.org/"][B]PyGame[/B][/URL], which uses Python... Good luck! | |
Hi all. I'm writing a little program that paints and animates its own form in response to the user's mouse gestures. The weird thing is: Whenever the [B]BDS Delphi 2006 is running[/B] and I run my application, I get a framerate of about 25 FPS. If I terminate BDS but … | |
Re: In both instances you are misusing the [URL="http://akrip.sourceforge.net/api/api3_4.html"][b]GetCDHandle[/b]()[/URL] function. The function takes a [i]pointer[/i] to an extant [b]GETCDHAND[/b] struct. [code=C++] HCDROM hcd; GETCDHAND cdhand; hcd = GetCDHandle( &cdhand ); [/code] Hope this helps. [edit] There might be other errors too... but I've got to go now [/edit] | |
Re: Sorry to respond to this late... but I wanted to post info also... The [b]getline[/b]() function has the obnoxious habit of returning a not [b]good[/b]() stream for final blank fields... For a single blank line at the end of input, that's fine... (there's no record) but for blank fields it … | |
Re: If you are going to be using buttons with pixel images (like a GIF) you will need to do pixel-hit testing yourself. Use the OnMouseDown event's X and Y values (which are relative to the button) to index a pixel in the image. Check that pixel's color against the transparent … | |
Re: It is easy enough with the mouse events. The MouseMove event handler should do something like the following [b][i]pseudocode[/i][/b]: [code=Delphi] procedure TFooey.MouseMove( ... ); begin if (nothing prevents you from responding to normal hovering) then if (x and y are in the object''s area) then begin if hover_mode <> hover … | |
Re: You are looking at the form resource data. Essentially, when the original program was written (in Delphi), the programmer used a [B]TImage[/B] component in the forms designer, double clicked the [b]Picture[/b] property in the [b]Object Inspector[/b], and [b]Load[/b]ed a bitmap file (or anything else his Delphi was able to load) … | |
Re: According to the Delphi documentation, the [B]TScreen.Fonts[/B] only lists "screen" fonts. You may want to also check in [b]TPrinter.Fonts[/b], as the font you want is technically for use with the printer... Hope this helps. | |
Re: Eh, why not? [code] uses SysUtils, Windows; procedure TypeStr( lpszString: pChar ); var cChar: char; vk: word; begin cChar := lpszString^; while cChar <> #0 do begin inc( lpszString ); vk := VkKeyScan( cChar ); if ((vk shr 8) and 1) <> 0 then keybd_event( VK_LSHIFT, 0, 0, 0 ); … | |
Re: I agree with [b]AD[/b] that the FTP is probably what is going wrong. FTP defaults to text mode. You must explicitly set it to binary mode before copying files. | |
Re: Alas, you have little to look forward to. Unless you [I]must[/I] decompile or reverse-engineer, you are typically better-off just rewriting the thing. If undaunted, check out this [URL="http://delphi.about.com/od/devutilities/a/decompiling.htm"]About.com article about decompiling Delphi code[/URL]. Good luck. | |
Re: What are you writing? An OS? We're not a translation service. You may want to try the [URL="http://www.daniweb.com/forums/forum72.html"][b]Looking to Hire[/b][/URL] forum. | |
Re: You have a very non-obvious error: the default copy constructor is in use. Make sure that GetSingleton() returns a [I]pointer[/I] to type Singleton. Hope this helps. ![]() | |
Re: I think that the compiler is complaining that it doesn't know what [inlinecode]NumOfPlayers[/inlinecode] is, or believes it to be something other than a variable. Likewise in your argument list, one of them is not the type of thing it ought to be? This can occur due to a syntax error … | |
Re: It is because of default type promotion. &integer is an (int *), which has no << overload, so it gets converted to an integer type and displayed. Likewise, &letterarray is an (char[11] *), so it gets converted to an integer type and displayed. However, &letter is a (char *), which … | |
Re: BP variants don't accept binary numbers. [i]Assemblers[/i] accept binary numbers. Since Delphi has a built-in assembler, you can use binary numbers with the assembler -- but [i]not[/i] in the normal Pascal code. [b]FlamingClaw[/b] -- that page is for a Pascal compiler which supports ISO-10206 (Extended Pascal), which is largely incompatible … | |
Re: If your assignment was to do it in a high level language then why play with assembly? The fastest way to convert would be to tell the compiler to produces assembly source instead of a binary image. If you are using the GCC: [inlinecode]g++ -S -fverbose-asm foo.cpp[/inlinecode] Other compilers will … | |
Re: I don't currently have access to Solaris ATM... alas, but perhaps it is something as simple as needing a blank line after each target: [code=Make] CC = cc run: driver.o CC -o run driver.o driver.o: driver.cpp CC -c driver.cpp [/code] BTW, you [i]can[/i] have tabs in the forum message boxes, … | |
Re: Alas, the OP want's to know how to insert those obnoxious commas (,) in between digits. Remember to use integer division and modulo (remainder) to split numbers apart ([inlinecode]/[/inlinecode] and [inlinecode]%[/inlinecode]). For example: [code] 1492 % 10 --> 2 1492 / 10 --> 149 149 % 10 --> 9 149 … | |
Re: Hey there, he has good reason for hating Solaris. Make sure you are compiling with the [B]GCC[/B] and not the Sun Studio CC. Also make sure you have the GNU make ([B]gmake[/B]) installed and use it by default instead of the Sun's make. Finally, check that the shared libraries are … | |
Re: Oy! Please [b]don't[/b] use a vector (or any other STL container) to hold individual pixel data -- Just draw directly to the target surface. Also, you needn't directly calculate [i]every[/i] pixel in the circle. One quarter of them is sufficient. (That is, calculate 1/4 of the circle, and draw four … | |
Re: In Pascal, a semicolon [i]separates[/i] statements (and terminates directives). So the following is correct: [code=Pascal] program Hello; { Semicolon terminates directive } begin writeln( 'Hello world!' ) { No semicolon necessary } end. [/code] As is: [code=Pascal] program Hello; begin write( 'Hello ' ) ; { semicolon separates statements } … | |
Re: I'm sure your instructor has given you much more information than you have given us. Make sure you review how to open pipes: [URL="http://linux.die.net/man/7/pipe"][b]man 7 pipe[/b]: overview[/URL] [URL="http://linux.die.net/man/2/pipe"][b]man 2 pipe[/b]: create pipe manual page[/URL] And, for good measure, an article on [B][URL="http://www.linux.com/articles/45679"]Pipes and filters[/URL][/B]. Your professor should have also given … | |
Re: Certainly. [URL="http://www.google.com/search?btnI=I%27m+Feeling+Lucky&ie=UTF-8&oe=UTF-8&q=msdn+setconsoletextattribute"][b]SetConsoleTextAttribute[/b]()[/URL] Hope this helps. | |
Re: The best way to learn such things is to read the Python documentation. [URL="http://www.python.org/doc/2.5.2/ext/embedding.html"][b]Embedding Python in Another Application[/b][/URL] Hope this helps. | |
Re: It might help to consider what two things you are doing. 1) input an array 2) return its sum The main program should work something like [code] main() { sum = 0; while (user wishes to input an array) { sum += get_and_sum_array(); } print sum; } int get_and_sum_array() { … | |
| |
Re: Lousy timeout... You don't actually have to [b]fork[/b](), just [b]poll[/b]() or [b]select[/b]() on the appropriate channels. As for [b]cin[/b] -- that is, by default, a [i]line-buffered[/i] input (meaning, it blocks until the user presses the Enter key). Making the standard input non-blocking and reading it is not trivial in *nix. … | |
Re: The [B]strrev()[/B] function is somewhat more common on windows. In linux you have an even shot of having it and not having it. It isn't in the ISO standard (AFAIK). Here's a simple strrev: [code] char *strrev( char *s ) { char *u, *v; char c; for (u = s, … | |
Re: If I had to do it in-place, I would have just reversed the entire string, then reversed each word in the string... But you did a good job with your temp strings. Nice! | |
Re: It is because you are reading input to random memory. Line 24's [b]num[/b] variable should be declared as: [code=C] char num[ 100 ]; [/code] (Where '100' is just the maximum number of character's I'd accept from the user.) Also, please avoid use of the [b]gets[/b]() function. Your instructor should not … | |
Re: getch() and variants are not cross-platform. Your best bet is to use the [B][I]curses[/I][/B] library. There are three variants: curses (the oldest and most basic), ncurses (a big improvement), and pdcurses (ditto). Most (if not all) Unix/Linux platforms have at least curses, if not ncurses. PDCurses, in addition to Unix … | |
Re: Why do you want to do that? (In other words, unless you are writing a full-screen text application like an editor or video game, [B][I]don't do that[/I][/B].) Otherwise, on [B]Windows[/B], see [URL="http://msdn.microsoft.com/en-us/library/ms682022(VS.85).aspx"]Example Two[/URL] On [B]Unix/Linux/POSIX[/B]: [code=C++] #include <unistd.h> #include <term.h> void clearscreen() { if (!cur_term) { int success; setupterm( NULL, … | |
Re: Don't learn MFC if you can avoid it. ;) If you aren't using Windows (or even if you are and want more choices) check out [URL="http://www.free-soft.org/guitool/"][b]The GUI Toolkit, Framework Page[/b][/URL]. wxWidgets, GTK, and FLTK are the usual favorites. Hope this helps. | |
Re: No. [i]Automatic[/i] variables are freed: [code=C] int foo() { int a = 42; int* p = (int*)malloc( sizeof( int ) ); *p = a; return a; } [/code] Once [b]foo[/b]() returns, the automatic variables [b]a[/b] (an int) and [b]p[/b] (a pointer) are freed, but the [i]heap[/i] variable created on line … | |
Re: After a little googling I found that Borland's [B]AnsiString[/B] is actually a [B][I]class[/I][/B], much like [B]std::string[/B]. So your code should say: [code] MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, tempstring.c_str(), -1, buff, sizeof(buff)); [/code] Hope this helps. | |
Re: I'm sorry, but you got too much of a bone from that last one. Method 1: Get yourself a large piece of paper and a couple pennies. Draw yourself two lists, like [inlinecode]4 7 9 23 -2 14 5[/inlinecode] [inlinecode]6 5 1 0[/inlinecode] place the pennies at the head of … | |
Re: Heh, well, you are certainly jumping in by the deep end. You might want to check out [URL="http://ffpis.sourceforge.net/"]sourceforge[/URL] for fingerprint software. It is by no means a simple programming exercise. The ignition for the car is basically a simple mechanical switch on the same stator as the lock. Insert the … | |
Re: Yes, use them in a loop. You should be looking at the [b]mult[/b] and [b]add[/b] opcodes. Remember how a number is constructed: by powers of ten. 5 * 10^2 = 500 4 * 10^1 = 40 3 * 10^0 = 3 add them all up to get 543. Hope this … | |
Re: Post what you've got and what part of it is giving you trouble. |
The End.