Search Results

Showing results 1 to 40 of 921
Search took 0.10 seconds.
Search: Posts Made By: Narue ; Forum: C++ and child forums
Forum: C++ 5 Days Ago
Replies: 5
Views: 204
Posted By Narue
>Why is this producing an error?
Stream objects aren't copyable at the object level. As jonsca said, you need to pass a reference to the ifstream.
Forum: C++ 6 Days Ago
Replies: 4
Solved: functions
Views: 188
Posted By Narue
>would you happen to know any good example on how to thread?
Proper multi-threading is non-trivial, so you're not likely to find one example that will teach you what you need. My recommendation...
Forum: C++ 6 Days Ago
Replies: 4
Solved: functions
Views: 188
Posted By Narue
Check the class of whatever aPort is to see if it has a non-blocking read, or some way to query the port for incoming data. If not, you might want to look into spawning a separate process or thread...
Forum: C++ 6 Days Ago
Replies: 8
Solved: return question
Views: 281
Posted By Narue
>I've seen a few odd programs (emphasis on the odd)
>that actually use the bool return type for main...
Once again, it's a requirement that main return the int type. bool main() is just as wrong...
Forum: C++ 6 Days Ago
Replies: 7
Views: 334
Posted By Narue
>is this possible?
Is this a troll? Or a bad joke? Of course it's possible, as are most things that noobs use the "is it possible?" question to ask about.
Forum: C++ 6 Days Ago
Replies: 8
Solved: return question
Views: 281
Posted By Narue
>In most, if not all OSes; if a program's main function returns an int, 0
>indicates that program execution ended normally.
>Any other value indicates that the program execution ended ...
Forum: C++ 7 Days Ago
Replies: 3
Solved: Random in Class
Views: 182
Posted By Narue
>I've tried stuff like srand(time) in main, however, that doesn't apply to the class
And if you do it in, say, the constructor, what do you expect will happen when you create two objects of that...
Forum: C++ 7 Days Ago
Replies: 3
Solved: hi all
Views: 196
Posted By Narue
So basically you don't know how to write the program and want us to hold your hand (or do it for you). Sorry, but no go. You'll have to work a little harder than that for your code to count as proof...
Forum: C++ 13 Days Ago
Replies: 5
Views: 455
Posted By Narue
>How, without using a library written by someone else <snip> can I
>possibly write my model files on one platform, and load on another
>without either: using text files, or wasting space in my...
Forum: C++ 15 Days Ago
Replies: 7
Views: 259
Posted By Narue
>I belive three, for(Iterator = something ; while-condition; do something to limit the loop ) ?
That's correct. Now take a look at your code and see if it matches what you just described.
Forum: C++ 15 Days Ago
Replies: 7
Views: 259
Posted By Narue
>Lines 124 and 132 contain the same two errors.
I'll answer your question with another question: How many clauses does a for loop have?

p.s. You also need to include the <string> header.
Forum: C++ 16 Days Ago
Replies: 6
Views: 256
Posted By Narue
You can specialize myclass::function based on the template parameters of myclass:

#include <iostream>

struct mystruct {};

template <class T>
class myclass
{
public:
Forum: C++ 16 Days Ago
Replies: 11
Views: 462
Posted By Narue
>Narue, WHY are you ranting about it?
Because I'm trying to help you, and I think ranting is the only way you'll pay attention. You should be flattered. Normally, I wouldn't bother replying to...
Forum: C++ 16 Days Ago
Replies: 2
Solved: Vectors
Views: 207
Posted By Narue
Did you check your handy C++ library reference? Because it's all explained there, and a more specific question than "can you tell me everything I want to know?" is likely to encourage high quality...
Forum: C++ 16 Days Ago
Replies: 11
Views: 462
Posted By Narue
>Because once I press ignore, check the log file, see the record
>where the problem occurred, and fix the format, then I don't have a problem anymore.
Then you're parsing the file incorrectly. The...
Forum: C++ 16 Days Ago
Replies: 11
Views: 462
Posted By Narue
>No see it's ok if it's ignored.
No, see it's not. A debug assertion doesn't mean you hit an expected runtime error condition, and it doesn't mean that your files aren't formatted the way your...
Forum: C++ 16 Days Ago
Replies: 11
Views: 462
Posted By Narue
>is there a way to make it ignore automatically? Without the message box appearing?
Yes, fix the error that causes the message in the first place. Silencing an error doesn't make the error go away,...
Forum: C++ 18 Days Ago
Replies: 3
Views: 223
Posted By Narue
>1. Line #8 works (at least my compiler doesn't comply), but line #12 is not allowed. Why?
Because the types are incompatible. It's legal to add a const qualifier as such:

int *p = 0;
const int...
Forum: C++ 19 Days Ago
Replies: 6
Views: 257
Posted By Narue
>I am using Visual C++
More specifically, it looks like you're using C++/CLI. I don't recommend mixing standard C++ libraries (such as ifstream) and .NET libraries (like System::String). It's more...
Forum: C++ 19 Days Ago
Replies: 6
Views: 257
Posted By Narue
std::string name;

// Get the name...

std::ifstream in ( ( name + ".txt" ).c_str() );
Forum: C++ 19 Days Ago
Replies: 3
Views: 258
Posted By Narue
I can't do anything about your eyesight. But it does show an example of how to define the function under the heading "Compound Assignment Operators += -= *=".
Forum: C++ 19 Days Ago
Replies: 3
Views: 258
Posted By Narue
>I cannot find on the web.
You didn't look very hard, did you? This (http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html) is the first hit from google that I got using keywords...
Forum: C++ 20 Days Ago
Replies: 6
Views: 264
Posted By Narue
I can't tell you where your problem is. I'm not quite that psychic. But I can tell you that if you have a custom allocator on m_argument, it's very possible that a bug in the allocator is leaking...
Forum: C++ 20 Days Ago
Replies: 6
Views: 264
Posted By Narue
>at this point of time i'm not sure on your question
So are we talking about a codebase that's a team effort or otherwise isn't written entirely by you?
Forum: C++ 20 Days Ago
Replies: 6
Views: 264
Posted By Narue
>Below is the block of code for your reference.
Are you using a custom allocator?
Forum: C++ 20 Days Ago
Replies: 5
Views: 240
Posted By Narue
>Sry i was trying to quote from this answer and i accidentally gave -1 at the answer.
I fixed it for you. Now it's back at 0. :)

>Can u write the de-allocation of memory in 1 in code pls??

//...
Forum: C++ 21 Days Ago
Replies: 10
Views: 570
Posted By Narue
Dude, your code is severely broken in several ways. I can only assume that MyFunction is equally crappy. Start by normalizing your expected/actual types, and fix your overflow errors. I'd help you...
Forum: C++ 21 Days Ago
Replies: 10
Views: 570
Posted By Narue
MyChar is an array of char. a[i] is a single char. The two types are completely incompatible. MyChar[i] = a[i] would work. At least until i gets incremented past 1, then you're accessing a out of...
Forum: C++ 21 Days Ago
Replies: 3
Solved: a code an error
Views: 176
Posted By Narue
GetData and GetSize are called on objects that are qualified as const. In such a case the compiler has to assume that both of those functions modify the state of the object, so it disallows the call....
Forum: C++ 21 Days Ago
Replies: 7
Solved: File
Views: 237
Posted By Narue
>First you did not change the while as narue said
>while ( getline ( plainText, plainLine ) ) {
>instead of
>while (getline(plainText, plainLine)){
Um...what? Do you really think a few extra...
Forum: C++ 21 Days Ago
Replies: 4
Views: 298
Posted By Narue
>here is what i have so far (it won't compile)
So what do you want us to do? Finish it up for you, tie it up with a pretty little bow, and send it to your teacher with your name on it? Why don't you...
Forum: C++ 22 Days Ago
Replies: 5
Views: 235
Posted By Narue
>is their any body tell me the Difference between int* a; and int *a; ?
From a language standpoint there's no difference. However, placing the asterisk by the variable makes more sense when you have...
Forum: C++ 22 Days Ago
Replies: 7
Solved: File
Views: 237
Posted By Narue
The >> operator is default delimited by whitespace. If your strings need to contain whitespace, use getline instead.

FYI:

>ifstream plainText(inputPath.c_str());
>ofstream...
Forum: C++ 23 Days Ago
Replies: 7
Views: 469
Posted By Narue
>my questiion would be
Ooh, let's see.

>can some one tell me what to do next
That's not a question, that's a request for hand holding. By specific question, I mean specific question. Not "I'm...
Forum: C++ 23 Days Ago
Replies: 5
Views: 321
Posted By Narue
>Think about the relationship described by inheritance,
>and why what you're doing isn't possible
And yet it is possible. What the OP wants to do is called downcasting. It's not recommended for...
Forum: C++ 23 Days Ago
Replies: 2
Views: 346
Posted By Narue
>myarray.clear(); //Doesnt deallocate the memory
Correct. Clearing the array only changes the size.

>myarray.reserve(0); //Doesnt deallocate memory
Correct. Reserving space only causes...
Forum: C++ 23 Days Ago
Replies: 7
Views: 279
Posted By Narue
It's called an initialization list. The code is roughly equivalent to this:

foo ( int limit, void (*action)() )
{
_i = 0;
_limit = limit;
_action = action;
}
Forum: C++ 23 Days Ago
Replies: 7
Views: 469
Posted By Narue
It looks like you're on the right track. Do you have a specific question?
Forum: C++ 23 Days Ago
Replies: 7
Views: 279
Posted By Narue
Just use a pointer to a function for the callback:

#include <iostream>

class foo {
int _i;
int _limit;
void (*_action)();
public:
foo ( int limit, void (*action)() )
Forum: C++ 23 Days Ago
Replies: 9
Views: 429
Posted By Narue
>I have tried everything you have suggested
Did you try this?

std::wcout<< cs.GetBuffer() << '\n'; // cs is the CString object

>However the following line of code works:
Well, DUH! That line...
Showing results 1 to 40 of 921

 


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

©2003 - 2009 DaniWeb® LLC