Search Results

Showing results 1 to 40 of 144
Search took 0.02 seconds.
Search: Posts Made By: dwks ; Forum: C++ and child forums
Forum: C++ Sep 8th, 2009
Replies: 13
Views: 620
Posted By dwks
Well then use "/home/USER/.todo" or better yet "~/.todo". Saying "/.todo" is like saying "/usr" or "/home"; it gets you a file relative to the root of the filesystem, which as I have said before, is...
Forum: C++ Sep 5th, 2009
Replies: 4
Views: 302
Posted By dwks
#define isn't what you need. #define does compile-time text substitution, as if you'd done a search-replace just before every compilation.


That looks like a reasonable idea. You'll probably want...
Forum: C++ Sep 5th, 2009
Replies: 13
Views: 620
Posted By dwks
Yes, but "/.todo" is a hidden file *in the root of the drive*, and it's extremely probable that you don't want to be writing there. If you want a hidden file, fine, use ".todo" or "./todo" to...
Forum: C++ Sep 3rd, 2009
Replies: 4
Views: 302
Posted By dwks
Yes, new members register at an astonishing rate here . . . when I logged in there were six less members than there are now. :)


[Sorry if this is a bit advanced. I assume you're a pretty good...
Forum: C++ Sep 3rd, 2009
Replies: 13
Views: 620
Posted By dwks
I'm also thinking that this
string todo = "/.todo.txt";

should be "./" instead of "/.".
Forum: C++ Aug 31st, 2009
Replies: 5
Views: 394
Posted By dwks
You use -99 in your input file to indicate end of line, but you seem to expect -999 in your program . . . .

Just a thought: why don't you read in one line at a time, and treat that as the row of a...
Forum: C++ Jun 8th, 2009
Replies: 2
Views: 675
Posted By dwks
A constant variable can't be changed after initialization. If you didn't initialize it, too bad, you still can't change it. (If you compiler is a good one, it may warn you that you haven't...
Forum: C++ Jun 8th, 2009
Replies: 5
Views: 266
Posted By dwks
I've really told you all you need to know. I'll give you some more details, but you'll have to do some searching . . . .

Three steps.

Open the file. You use ifstream to do this, it's not hard....
Forum: C++ Jun 8th, 2009
Replies: 2
Views: 863
Posted By dwks
Too bad you're not using PHP. :) http://ca2.php.net/filesize

But it seems like it might not be possible: http://bytes.com/groups/php/595984-filesize-not-reading-http-pages

On the other hand,...
Forum: C++ Jun 8th, 2009
Replies: 5
Views: 266
Posted By dwks
Well, that's not too difficult. You could open the file, read it line-by-line, and print only those lines which contain the word "WARNING", for example. If you wanted to be more robust, you could...
Forum: C++ Jun 8th, 2009
Replies: 2
Views: 1,057
Posted By dwks
Did you try google? There seem to be a lot of hits relating to this. http://www.google.ca/search?q=sdl_ttf+opengl

You can use SDL_ttf's TTF_RenderText_Blended to get smoothed SDL text surfaces. I...
Forum: C++ Aug 15th, 2008
Replies: 3
Views: 1,456
Posted By dwks
while ( !feof(ep) )
{
fgets(registryHive, MAX_PATH, ep);

Note that this is not a good idea...
Forum: C++ Aug 5th, 2008
Replies: 9
Views: 3,570
Posted By dwks
The best way to do this is perhaps this: declare a structure representing the information. (Perhaps a header structure, a data one, a tail, and a packet structure that contains all three.)

If you...
Forum: C++ Aug 5th, 2008
Replies: 18
Solved: enum warnings
Views: 1,590
Posted By dwks
What? Never heard of that. Don't tell me,
this don't work
x = bool (x||y) ;
That is C++ only. The C way looks like this.
x = (bool)(x || y);
Perhaps the OP is compiling as C instead of C++.
...
Forum: C++ Jul 24th, 2008
Replies: 10
Views: 1,011
Posted By dwks
switch (choice)
{
case '1':
saveGame();
case '2':
switch (missionNumber)
{
case 1:
...
Forum: C++ Jul 16th, 2008
Replies: 8
Solved: Alignement
Views: 793
Posted By dwks
So your question is, why does structure alignment apply to the last member of a structure?

I think the answer is the same as for why structure alignment exists in the first place. Structure...
Forum: C++ Jul 16th, 2008
Replies: 10
Views: 1,011
Posted By dwks
Use code=c++ in your code tags to get syntax highlighting. It makes the code a lot easier to read.

iostream.h doesn't actually exist (according to the C++ standard). Consider using
#include...
Forum: C++ Jul 2nd, 2008
Replies: 4
Views: 593
Posted By dwks
In order to use the ifstream fin variable that you declare inside the switch statement, you need to declare it outside the switch statement. For example:
ifstream fin;
switch(choose) {
case 1:
...
Forum: C++ Jul 2nd, 2008
Replies: 27
Views: 2,124
Posted By dwks
http://board.theprogrammingsite.com/viewtopic.php?t=113&sid=57532b7c18db0b6089757cc195c714b4
Forum: C++ May 31st, 2007
Replies: 2
Views: 823
Posted By dwks
while(indicator = 'y')
You want == for comparison.
Forum: C++ Mar 3rd, 2007
Replies: 4
Views: 876
Posted By dwks
The lines that are causing the code colourer to mess up are these:
cout<<"<A href="http://www.tuungane.org"<<endl">www.tuungane.org"<<endl;
cout<<"<A...
Forum: C++ Mar 3rd, 2007
Replies: 3
Views: 1,832
Posted By dwks
There are many functions that you are using that have no equivalent -- in fact nearly all; if there were exact equivalents then the programmer would have used those instead, most likely.

This...
Forum: C++ Feb 14th, 2007
Replies: 7
Views: 7,214
Posted By dwks
Here's another gotoxy() link: http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044844545&id=1043284392

Here's another useful Windows Console programming link, perhaps you'll find what...
Forum: C++ Feb 14th, 2007
Replies: 3
Views: 2,858
Posted By dwks
Really? . . . http://eternallyconfuzzled.com/arts/jsw_art_rand.aspx

Either way works, and some would recommend the OP's way over yours (myself included).

If you want it to generate numbers...
Forum: C++ Feb 7th, 2007
Replies: 4
Views: 961
Posted By dwks
You have a lot of repetitive code there that could go outside of the if statement . . .
Forum: C++ Feb 7th, 2007
Replies: 16
Views: 3,330
Posted By dwks
"Without a toolkit"? Sure, but you'd be writing a lot of platform-specific code. You could use regular old Windows programming. You could use the Gnome or KDE libraries.

What operating system are...
Forum: C++ Feb 7th, 2007
Replies: 7
Views: 3,295
Posted By dwks
C was designed with efficiency in mind. (And C++ was developed with C in mind.) Variable types vary from machine to machine, so that the compiler can pick the most efficient type for a given...
Forum: C++ Jan 19th, 2007
Replies: 5
Views: 1,895
Posted By dwks
If you're in delete mode, try pressing the insert key as suggested.

What editor are you using?
Forum: C++ Jan 19th, 2007
Replies: 3
Views: 1,455
Posted By dwks
You're also missing a closing curly brace } at the end of your program, but that's probably just a typo.
Forum: C++ Jan 3rd, 2007
Replies: 14
Views: 2,979
Posted By dwks
Presumably you meant
system("DIR C:\\");


Also see http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1044654269&id=1043284392
Forum: C++ Jan 3rd, 2007
Replies: 4
Views: 3,540
Posted By dwks
I realize that, but I thought you didn't, because you said

and linked to the DJGPP version.

Does the Borland version work?
Forum: C++ Jan 3rd, 2007
Replies: 4
Views: 10,173
Posted By dwks
As for keeping score, you could have two variables.
int games_won_by_computer;
int games_won_by_player;

Once you're done that game, you could try a guessing game where the user guesses a random...
Forum: C++ Jan 3rd, 2007
Replies: 4
Views: 3,540
Posted By dwks
That program is meant to be compiled with DJGPP (www.delorie.com/djgpp). Use the version meant to compile with Borland compilers: http://www.brackeen.com/home/vga/source/bc31/bitmap.c.html

Better...
Forum: C++ Dec 30th, 2006
Replies: 19
Views: 3,026
Posted By dwks
See this line?
Deck::deck()
It should look like this.
Deck::Deck()

Too slow.
Forum: C++ Dec 30th, 2006
Replies: 12
Views: 13,923
Posted By dwks
If you don't care what the beep sounds like just print a '\a' character.
cout << '\a';
or
putchar('\a');
Forum: C++ Dec 30th, 2006
Replies: 8
Views: 3,020
Posted By dwks
http://www.daniweb.com/code/snippet83.html
http://www.daniweb.com/code/snippet72.html
Forum: C++ Dec 30th, 2006
Replies: 19
Views: 3,026
Posted By dwks
Okay, here's your problem.
Deck::deck()

deck() doesn't match the class name Deck so it isn't a constructor. C++ is case-sensitive. Use a constructor name that matches the class name exactly -- in...
Forum: C++ Dec 30th, 2006
Replies: 19
Views: 3,026
Posted By dwks
I don't have a line-numbering editor on this computer, and I'm not counting to 214. Post the actual line that is causing the error.
Forum: C++ Dec 30th, 2006
Replies: 19
Views: 3,026
Posted By dwks
Error 1 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Use int function() or void function(), not just function().

Which line is this on?
Warning 3...
Forum: C++ Nov 22nd, 2006
Replies: 6
Views: 6,906
Posted By dwks
Only very ancient compilers have dos.h. The ANSI-standard functions in <time.h> are a much better bet.
Showing results 1 to 40 of 144

 


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

©2003 - 2009 DaniWeb® LLC