1,118 Posted Topics

Member Avatar for mauriciomf

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.

Member Avatar for beryllium9
0
561
Member Avatar for ambarisha.kn

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( …

Member Avatar for Duoas
0
235
Member Avatar for guyod

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 …

Member Avatar for guyod
0
167
Member Avatar for esesili

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 …

Member Avatar for marco93
0
114
Member Avatar for licktress

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 …

Member Avatar for Ancient Dragon
0
219
Member Avatar for MV89

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"); } …

Member Avatar for JasonHippy
0
164
Member Avatar for johnyjj2

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 -- …

Member Avatar for johnyjj2
0
2K
Member Avatar for Hiroshe

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?

Member Avatar for Duoas
0
2K
Member Avatar for furqankhyraj

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.

Member Avatar for Ancient Dragon
0
166
Member Avatar for iamsmooth

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 ) …

Member Avatar for Duoas
0
324
Member Avatar for Silvershaft

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!

Member Avatar for swinefish
0
105
Member Avatar for Duoas

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 …

Member Avatar for Duoas
0
189
Member Avatar for Stefano Mtangoo

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]

Member Avatar for Stefano Mtangoo
0
199
Member Avatar for Yaserk88

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 …

Member Avatar for Ancient Dragon
0
4K
Member Avatar for ebi1

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 …

Member Avatar for ebi1
0
206
Member Avatar for victorxata

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 …

Member Avatar for Duoas
0
197
Member Avatar for dorkwad

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) …

Member Avatar for Duoas
0
1K
Member Avatar for squeege321

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.

Member Avatar for Duoas
0
160
Member Avatar for Nowayz

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 ); …

Member Avatar for Duoas
0
221
Member Avatar for shealy

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.

Member Avatar for Krushnat
0
549
Member Avatar for fromb

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.

Member Avatar for Duoas
0
157
Member Avatar for Leila1

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.

Member Avatar for Salem
0
441
Member Avatar for unclepauly

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.

Member Avatar for jencas
0
2K
Member Avatar for ShaneM

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 …

Member Avatar for ShaneM
0
164
Member Avatar for Bythos

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 …

Member Avatar for trillionaire
0
224
Member Avatar for m610

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 …

Member Avatar for weinelb
0
1K
Member Avatar for therealsolitare

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 …

Member Avatar for Salem
0
6K
Member Avatar for kyosuke0

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, …

Member Avatar for Duoas
0
131
Member Avatar for queensrose

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 …

Member Avatar for Duoas
0
175
Member Avatar for drjay1627

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 …

Member Avatar for drjay1627
0
81
Member Avatar for ixuz

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 …

Member Avatar for Duoas
0
195
Member Avatar for turbomen

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 } …

Member Avatar for Duoas
0
94
Member Avatar for Samran

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 …

Member Avatar for Samran
0
287
Member Avatar for Willco

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.

Member Avatar for NicAx64
0
167
Member Avatar for tomtetlaw

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.

Member Avatar for Duoas
0
109
Member Avatar for smithu.simi

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() { …

Member Avatar for Duoas
0
311
Member Avatar for Again
Member Avatar for Barefootsanders

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. …

Member Avatar for Duoas
0
130
Member Avatar for siri_lito

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, …

Member Avatar for sophia77
0
329
Member Avatar for noob.pas

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!

Member Avatar for tylcoatc
0
1K
Member Avatar for Rein Valdez

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 …

Member Avatar for Rein Valdez
0
419
Member Avatar for Ratte

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 …

Member Avatar for Comatose
0
1K
Member Avatar for azwraith69

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, …

Member Avatar for Ancient Dragon
0
477
Member Avatar for Anshulpareek

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.

Member Avatar for Duoas
0
44
Member Avatar for Somersett

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 …

Member Avatar for Duoas
0
113
Member Avatar for parse loki

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.

Member Avatar for skatamatic
0
818
Member Avatar for Olsi009

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 …

Member Avatar for LizR
0
317
Member Avatar for blurrycustoms

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 …

Member Avatar for ARUN(MCA)
0
146
Member Avatar for ziggyz

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 …

Member Avatar for hammerhead02
0
69
Member Avatar for bastek

The End.