Forum: C++ Sep 1st, 2009 |
| Replies: 1 Views: 195 Never mind - looks like the system call I wanted was statfs()
http://linux.die.net/man/2/statfs |
Forum: C++ Sep 1st, 2009 |
| Replies: 1 Views: 195 Hi,
I'm trying to write some code that will validate if we are trying to write to nfs and if so, complain. From what I've read, the stat() call populates the st_dev with value of the file system... |
Forum: C++ Nov 23rd, 2008 |
| Replies: 1 Views: 283 Looks like this was the solution:
http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9
(I added a 'using Base::print' to my NewOne class) |
Forum: C++ Nov 23rd, 2008 |
| Replies: 1 Views: 283 Consider this working code:
#include <iostream>
using namespace std;
class Base
{
public:
void print(string val)
{ |
Forum: C++ Sep 12th, 2008 |
| Replies: 1 Views: 732 Hi,
Trying to play with multithreading by taking some of my existing apps and converting them over. In doing so, I noticed a strange phenomenon that I've been able to reproduce in a very simple... |
Forum: C++ Apr 14th, 2007 |
| Replies: 6 Views: 5,230 vijayan121 (http://www.daniweb.com/techtalkforums/member134320.html), I don't think ifstream works for files over 2GB, which mine is. (7GB) |
Forum: C++ Apr 13th, 2007 |
| Replies: 6 Views: 5,230 Is there a way using file handling functions to search within a text file to find the position of certain text WITHOUT having to read each character/line and evaluating it?
For example, let's say... |
Forum: C++ Jun 27th, 2006 |
| Replies: 9 Views: 3,469 Dave,
In the end that's what I pretty much ended up doing. Just thought there might be a faster/more efficient approach. |
Forum: C++ Jun 27th, 2006 |
| Replies: 9 Views: 3,469 A valid question. The reason is this is data that USED to be in the database and was 'archived' off. |
Forum: C++ Jun 27th, 2006 |
| Replies: 9 Views: 3,469 So here's what I'm trying to do. Basically, I have a huge text file of strings which are delimited by a delimiter. I would like to read each string separately based on the delimiter. Note that each... |
Forum: C++ May 14th, 2006 |
| Replies: 4 Views: 10,590 Assuming you won't in fact attempt to change 'crap' inside the 'bull' function, simply change the above to:
void bull( const char[] )
and
void bull( const char crap[] )
{
std::cout <<... |
Forum: C++ Apr 20th, 2006 |
| Replies: 10 Views: 3,660 That works, unfortunately, I don't want it to be a static function as I want it to use the instance of the class that I'm working in. |
Forum: C++ Apr 19th, 2006 |
| Replies: 10 Views: 3,660 Say what Dr. Dave?
I had trouble following your other thread too. guess I'm biting off more than I can chew. |
Forum: C++ Apr 19th, 2006 |
| Replies: 10 Views: 3,660 Dave,
Don't lose sleep over it. But if you're up anyway, yes please find the other thread ;)
WB |
Forum: C++ Apr 19th, 2006 |
| Replies: 10 Views: 3,660 Dave,
I was looking at that - went over my head. Is there an easy answer to my particular example? Part of the problem seems to be that I'm INSIDE my class when I'm trying to pass another member... |
Forum: C++ Apr 18th, 2006 |
| Replies: 10 Views: 3,660 So I'm trying to learn how to use function pointers (ie to pass the address of a function to another function to execute it - like a call back). I have it working when I use it as follows:
... |
Forum: C++ Apr 12th, 2006 |
| Replies: 5 Views: 3,257 Let me give you this hint - since several of the months have the same behavior - ie 1,3,5,7,8,10,12 are all 31 days, while 4,6,9,11 are all 30 days, then you could easily use a 'switch' statement on... |
Forum: C++ Mar 9th, 2006 |
| Replies: 4 Views: 1,088 Missing a semicolon here:
unsigned long k //k as an unsigned long integer
also, either change cout to std::cout or put a 'using namespace std;' at the top after the include. |
Forum: C++ Mar 3rd, 2006 |
| Replies: 5 Views: 1,527 You're treating deck[i] like a pointer when it's not. |
Forum: C++ Mar 2nd, 2006 |
| Replies: 10 Views: 2,226 You're gonna have to give us a bit more than that - how about some source code? |
Forum: C++ Feb 27th, 2006 |
| Replies: 8 Views: 1,571 Why are you doing cout so many times inside the loop? You're going to get like 400 printouts... |
Forum: C++ Feb 24th, 2006 |
| Replies: 5 Views: 3,088 As Narue was saying, cleanest way is to load each word from the file into something like a vector<string> myWords, then generate a random number between 0 and the vector's myWords.size(). Then you... |
Forum: C++ Feb 8th, 2006 |
| Replies: 4 Views: 5,913 #include <iostream>
#include <sstream>
using namespace std;
int main()
{
int a =23545;
ostringstream o;
o<<a;
cout<<o.str().size()<<endl;
return 0; |
Forum: C++ Jan 26th, 2006 |
| Replies: 13 Views: 5,572 http://www.delorie.com/djgpp/v2faq/faq22_25.html |
Forum: C++ Jan 25th, 2006 |
| Replies: 13 Views: 5,572 Also, main really should return an int. |
Forum: C++ Jan 21st, 2006 |
| Replies: 4 Views: 1,697 trade(word[i]) != '\n' || i < 5)
(don't you want && i< 5 ) |
Forum: C++ Jan 17th, 2006 |
| Replies: 5 Views: 1,225 add a 'using namespace std' at the top and see if it makes a difference. |
Forum: C++ Jan 17th, 2006 |
| Replies: 7 Views: 2,381 I could use a template or do the cast, the problem is that I want to do special processing based on the type (ie if it's a bool, then print it out as 'TRUE' or 'FALSE', etc. By adding the function... |
Forum: C++ Jan 17th, 2006 |
| Replies: 7 Views: 2,381 I figured it out. When I pass an int, it can't decide whether to use the bool or the long. I think I just need to create an int version of the function as well... |
Forum: C++ Jan 17th, 2006 |
| Replies: 7 Views: 2,381 What about if you pass a long to the function in main? |
Forum: C++ Jan 17th, 2006 |
| Replies: 7 Views: 2,381 Is there a way in C++ to deal with this? (a way to force that a boolean is strictly a boolean and cannot be converted to another numerical type?)
line 42: Error: Overloading ambiguity between... |
Forum: C++ Jan 15th, 2006 |
| Replies: 14 Views: 7,605 If look at my example, I don't think any cleanup was required because I didn't do a 'new', and I didn't need a clone method... |
Forum: C++ Jan 15th, 2006 |
| Replies: 14 Views: 7,605 Sounds reasonable, though when you were doing 'Animal &' I think you were running the same risk... Hopefully someone will be able to help - I definitely think it has to do with copy constructors...... |
Forum: C++ Jan 15th, 2006 |
| Replies: 14 Views: 7,605 Not sure about your question, I can tell you that I only got what you wanted to work (with the vectors, when I made the vector store pointers of Animal). I think it has something to do with the fact... |
Forum: C++ Jan 15th, 2006 |
| Replies: 14 Views: 7,605 Here's the deal - you need the 'virtual' word in the Animal class when defining eat(). (Don't do the =0)
See this example:
#include <iostream>
using namespace std;
class Animal
{... |
Forum: C++ Jan 15th, 2006 |
| Replies: 14 Views: 7,605 Now that I think about it, what you have should already work. When you call the eat method, is it calling the wrong one? |
Forum: C++ Jan 15th, 2006 |
| Replies: 14 Views: 7,605 When creating the eat() function in Animal , set it equal to 0. for example:
class Animal
{
void eat()=0;
}; |
Forum: C++ Jan 14th, 2006 |
| Replies: 3 Views: 999 What specifically do you need help with? |
Forum: C++ Jan 9th, 2006 |
| Replies: 8 Views: 1,442 It works for me:
#include <iostream>
using namespace std;
int main()
{
double determinant = 2.8*5*-9.5;
cout << "determinant = " << determinant<<endl;
return 0;
} |
Forum: C++ Jan 9th, 2006 |
| Replies: 8 Views: 1,442 Show us how you're printing it out. |