Search Results

Showing results 1 to 40 of 126
Search took 0.02 seconds.
Search: Posts Made By: Duoas
Forum: C++ Aug 10th, 2009
Replies: 3
Views: 569
Posted By Duoas
I suggest you take a read through The Function Pointer Tutorials (http://www.newty.de/fpt/), particularly this one (http://www.newty.de/fpt/fpt.html#r_value).

I would use some typedefs to help:
...
Forum: C Aug 6th, 2009
Replies: 18
Views: 1,152
Posted By Duoas
Forum: C++ Jul 21st, 2009
Replies: 13
Views: 1,509
Posted By Duoas
Sorry to respond to this late... but I wanted to post info also...

The getline() function has the obnoxious habit of returning a not good() stream for final blank fields...

For a single blank...
Forum: C++ Jul 6th, 2009
Replies: 30
Views: 1,522
Posted By Duoas
I agree with AD 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.
Forum: C Apr 7th, 2009
Replies: 3
Views: 1,250
Posted By Duoas
The wait() (http://linux.die.net/man/2/wait) function monitors the state of a process, not its I/O streams. What you really want is the poll() (http://linux.die.net/man/2/poll) or select()...
Forum: C++ Apr 3rd, 2009
Replies: 5
Views: 579
Posted By Duoas
Alas, I just googled it.

Try searching for things like "bresenham line circle ellipse algorithm".

Speed comes from doing the least to draw individual pixels. Hence, a lot of optimization comes...
Forum: C++ Jan 31st, 2009
Replies: 15
Views: 8,049
Posted By Duoas
I just can't fathom why truly brain-dead things like system("PAUSE") keep being taught.

I can only presume it is because important things like security, process control, system resource...
Forum: C++ Sep 24th, 2008
Replies: 3
Views: 1,857
Posted By Duoas
Yes, you really are asking an OS and SDK-dependent question.

If you are using something like SDL, then respond to the key events that SDL gives you. Most GUI/graphics toolkits will give you a way...
Forum: C++ Sep 24th, 2008
Replies: 11
Views: 881
Posted By Duoas
Good grief. Only use TerminateProcess() to kill the unruly.

Otherwise, just ask it nicely: send it a WM_CLOSE message. If it doesn't respond in, say, 500 ms or so, use CreateRemoteThread()...
Forum: C++ Sep 14th, 2008
Replies: 9
Views: 1,074
Posted By Duoas
If you read and write your files one byte at a time, endianness is not an issue.

However, bit order is always an issue. The first bit you write should be in bit position 0 of the first byte you...
Forum: C++ Sep 13th, 2008
Replies: 4
Views: 1,141
Posted By Duoas
You need to keep track of how many bits you have "output" so far. When you get eight or more, output a byte.

unsigned char bits = 0; // the unwritten bits
int count = 0; // the number of...
Forum: C++ Sep 6th, 2008
Replies: 5
Views: 1,286
Posted By Duoas
Google "mingw sdl" and take a look through the first few links.

If you haven't already, make sure to upgrade to the latest version of MinGW (Dev-C++ comes with a pretty old one).

Good luck!
Forum: C++ Sep 1st, 2008
Replies: 8
Views: 765
Posted By Duoas
Yes, it is an encoding issue. I suspect that it comes from the way your editor is saving the text file.

There are several ways to 'encode', or store, character data.

There is the old char-sized...
Forum: C++ Aug 31st, 2008
Replies: 4
Views: 730
Posted By Duoas
No, it is the same as all the files having a #define GRAPHICS
To have a value:
g++ -DGRAPHICS=1 --> #define GRAPHICS 1

if (GRAPHICS) will work if and only if GRAPHICS is always defined to have...
Forum: C++ Aug 24th, 2008
Replies: 12
Views: 6,738
Posted By Duoas
Empty files will never do anything except exist. ("Existing is basically all I do!" --Fry)

It also sounds like there is something misconfigured with your Code::Blocks IDE. Have you been able to...
Forum: C++ Aug 16th, 2008
Replies: 18
Views: 3,972
Posted By Duoas
In addition, you should have a removeBook() (or some such named) method(s) for the user's convenience.
Forum: C++ Aug 15th, 2008
Replies: 13
Views: 1,396
Posted By Duoas
Use the STL

#include <algorithm>
#include <fstream>
#include <iostream>
#include <iterator>
using namespace std;

int main( int argc, char** argv )
{
Forum: C++ Aug 13th, 2008
Replies: 10
Views: 989
Posted By Duoas
With just a very quick glance, that notOptimized() function needs some help. A bitvector (or vector<bool>) is not a good choice in such a function. Sad, but it was optimized for space, not speed.
...
Forum: C++ Aug 8th, 2008
Replies: 2
Views: 416
Posted By Duoas
Without even looking at your code, I will make a wild stab in the dark and say that you are using a Windows console to run your program?

If you are, right-click the icon on the console's title bar...
Forum: C++ Aug 8th, 2008
Replies: 15
Solved: namespace std
Views: 1,440
Posted By Duoas
semicolons
A semicolon by itself is considered a null statement, and has no meaning. Modern compilers will typically complain about them unless they explicitly terminate a statement. For example...
Forum: C++ Aug 6th, 2008
Replies: 15
Views: 2,052
Posted By Duoas
Heh heh heh -- I couldn't resist iamthwee's challenge (sorry conan --look below for where to get a dictionary).

// boggle-solver.cpp
// Copyright (c) 2008 Michael Thomas Greer
//...
Forum: C++ Aug 6th, 2008
Replies: 18
Views: 1,200
Posted By Duoas
Actually, putting that system pause in there contributed to my low opinion. You said that was an example of when he uses <cstring>.

gets() is pure evil and should be lynched at every opportunity....
Forum: C++ Aug 5th, 2008
Replies: 15
Views: 2,052
Posted By Duoas
How is your dictionary stored? If, like iamthwee suggests, it is a file with words in it, you can just search the file for the given word.

You can even use the STL for that:

#include...
Forum: C++ Aug 4th, 2008
Replies: 3
Views: 402
Posted By Duoas
#include <iomanip>
#include <iostream>
using namespace std;

int main()
{
for (int n = 1; n < 6; n++)
cout << n;
cout << setw( 5 ) << right << (167) << "mm\n";
return 0;
Forum: C++ Aug 4th, 2008
Replies: 5
Views: 2,363
Posted By Duoas
There is nothing more or less hard about C++ than any other programming language.

People fear C++ because it comes with a very large set of capabilities.

It can be used to program procedurally....
Forum: C++ Aug 3rd, 2008
Replies: 8
Views: 1,788
Posted By Duoas
In practice it doesn't impact performance.

What it does is make your code more usable, more correct, and easier to read.

All you ever wanted to know about const correctness...
Forum: C++ Jul 26th, 2008
Replies: 3
Solved: switch problem
Views: 442
Posted By Duoas
Olvidaste poner conullas al seis. while (producto != '6')
:$

Hope this helps.
Forum: C Jul 11th, 2008
Replies: 4
Views: 563
Posted By Duoas
I think you need to spend some time tracing through your algorithm. I'm not sure exactly what it is supposed to do, but I don't think it is doing what you want it to do...
(Given "HELLO", the list...
Forum: C++ Jul 7th, 2008
Replies: 9
Views: 3,848
Posted By Duoas
Ah, it is because seating is declared as a 2D array, but you are only indexing one dimension. Hence the error.

Did you mean to treat seating as a 1D array in your function? I'm not sure how you...
Forum: C++ Jul 3rd, 2008
Replies: 17
Views: 2,465
Posted By Duoas
OK, I told you I'd get you an example. I don't want to spend a lot of time finding the libraries to do it and coding one, but I do have an old program I wrote many many moons ago, when I was still...
Forum: C++ Jun 27th, 2008
Replies: 7
Views: 1,383
Posted By Duoas
That was just an example function I created. I expected that you would take the code you needed from it and put it in your own function.

I don't think that TTextBox::Text takes a std::string, does...
Forum: C++ Jun 25th, 2008
Replies: 5
Views: 1,567
Posted By Duoas
If all you want is teletype output (like you get on the console, without any fancy graphics or fonts or etc) you can open the PRN or LPT1 device:

#include <fstream>
#include <iostream>
using...
Forum: Assembly Jun 17th, 2008
Replies: 4
Views: 3,653
Posted By Duoas
Probably not. LC3 only exists in textbooks and moreover, people who volunteer here don't want to do your homework for you.

Give it an honest effort and we will help as you go along.
Forum: C++ Jun 13th, 2008
Replies: 12
Views: 1,641
Posted By Duoas
A char is guaranteed to contain 8 bits, at least. (And unless you are playing with really old hardware, like ancient vaxen, a byte is also 8 bits.) But the compiler is not required to store...
Forum: C++ Jun 11th, 2008
Replies: 8
Views: 506
Posted By Duoas
Google "linked list".

I presume each node represents a single atom?
Forum: Assembly Jun 10th, 2008
Replies: 2
Views: 722
Posted By Duoas
You'll want to play with MASM32 (http://www.masm32.com/). It has everything you need.

Good luck!
Forum: C++ Jun 4th, 2008
Replies: 12
Views: 1,103
Posted By Duoas
Actually it does have it backwards...

foo = this->foo; != this->foo = foo;

?
Forum: C++ Jun 4th, 2008
Replies: 12
Views: 1,103
Posted By Duoas
Depending on how the data is packed.

If it is packed (MSB...LSB) ARGB then

int alpha = (color >> (3 * 8)) & 0xFF;
int red = (color >> (2 * 8)) & 0xFF;
int green = (color >> (1 * 8)) & 0xFF;...
Forum: Software Development Job Offers Jun 3rd, 2008
Replies: 11
Views: 1,643
Posted By Duoas
You've got to be kidding, right? (Both of you.)

To be honest, Mr. Edwards has ticked me off more than some silly kid trying to cheat his way through schooling --because all such are eventually...
Forum: C Jun 3rd, 2008
Replies: 20
Views: 1,643
Posted By Duoas
There are only a couple that I'd recommend.

First, straight from esr himself:
http://web.cs.mun.ca/~rod/ncurses/ncurses.html

And another very good one, replete with great examples:...
Showing results 1 to 40 of 126

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC