Forum: C++ 1 Day Ago |
| Replies: 5 Views: 146 >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++ 1 Day Ago |
| Replies: 4 Views: 153 >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++ 1 Day Ago |
| Replies: 4 Views: 153 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++ 2 Days Ago |
| Replies: 8 Views: 241 >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++ 2 Days Ago |
| Replies: 5 Views: 205 >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++ 2 Days Ago |
| Replies: 8 Views: 241 >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++ 2 Days Ago |
| Replies: 3 Views: 155 >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++ 2 Days Ago |
| Replies: 3 Views: 162 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 3 Days Ago |
| Replies: 10 Views: 307 >I'm not arguing with you but global variables must be an accepted misconception..
It's well understood terminology, and everyone knows well enough what you mean when you say "global variable", so... |
Forum: C 3 Days Ago |
| Replies: 10 Views: 307 >In my case, I obtain errors (undefined reference to `myVar') when I use extern in "global.h."
Are you forgetting the definition? I added a globals.c file that forces an absolute definition for... |
Forum: C 4 Days Ago |
| Replies: 10 Views: 307 >I've read that global variables should be defined once and declared
>in evry file using those variables using the keyword extern?
Yes, that's a safe guideline. I'd do it like the following... |
Forum: C++ 9 Days Ago |
| Replies: 5 Views: 384 >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 11 Days Ago |
| Replies: 7 Views: 300 >I was thinking stdin
The stream in question is whatever input stream you want to clean up in a line-oriented fashion, but yes, it was written with stdin in mind.
>Will it be something like this... |
Forum: C++ 11 Days Ago |
| Replies: 7 Views: 230 >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++ 11 Days Ago |
| Replies: 7 Views: 230 >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++ 12 Days Ago |
| Replies: 6 Views: 243 You can specialize myclass::function based on the template parameters of myclass:
#include <iostream>
struct mystruct {};
template <class T>
class myclass
{
public: |
Forum: C 12 Days Ago |
| Replies: 7 Views: 300 >So, in a nutshell, I'm looking for an alternate of the non-standard getch();
Unfortunately, you can't do it in one line without making some assumptions or rolling the whole thing up into a... |
Forum: C++ 12 Days Ago |
| Replies: 11 Views: 433 >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++ 12 Days Ago |
| Replies: 2 Views: 202 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++ 12 Days Ago |
| Replies: 11 Views: 433 >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++ 12 Days Ago |
| Replies: 11 Views: 433 >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++ 12 Days Ago |
| Replies: 11 Views: 433 >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++ 14 Days Ago |
| Replies: 3 Views: 200 >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 14 Days Ago |
| Replies: 20 Views: 779 >I only posted because I agreed with the OP about our instructor.
>Then you proceed to call me a sock puppet...
Exactly. I call it like I see it, and if you have a problem with that, you're... |
Forum: C 14 Days Ago |
| Replies: 20 Views: 779 >Why even bother posting when someone is asking for help, you have a very poor attitude.
Pardon? You must have missed the fact that I was the first person to help Mattpd in this thread. You must... |
Forum: C 14 Days Ago |
| Replies: 20 Views: 779 >I can vouch for this guy
Yea, that's not suspicious at all. :icon_rolleyes: From past experience, I'm more inclined to believe that you're a sock puppet rather than a concerned classmate. |
Forum: C++ 15 Days Ago |
| Replies: 6 Views: 233 >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++ 15 Days Ago |
| Replies: 6 Views: 233 std::string name;
// Get the name...
std::ifstream in ( ( name + ".txt" ).c_str() ); |
Forum: C++ 15 Days Ago |
| Replies: 3 Views: 245 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++ 15 Days Ago |
| Replies: 3 Views: 245 >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++ 15 Days Ago |
| Replies: 6 Views: 257 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++ 15 Days Ago |
| Replies: 6 Views: 257 >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++ 15 Days Ago |
| Replies: 6 Views: 257 >Below is the block of code for your reference.
Are you using a custom allocator? |
Forum: C++ 15 Days Ago |
| Replies: 5 Views: 233 >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 16 Days Ago |
| Replies: 5 Views: 406 >Kindly let me know of alternatives of how I could solve this problem.
You're not actually appending to the file, you're appending to lines in the file, which amounts to inserting into the file.... |
Forum: C++ 16 Days Ago |
| Replies: 10 Views: 517 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++ 16 Days Ago |
| Replies: 10 Views: 517 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++ 17 Days Ago |
| Replies: 3 Views: 168 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 17 Days Ago |
| Replies: 20 Views: 779 >I am not certain where to start.
Then you should consider switching your major. "I don't know where to start" is equivalent to "I'm not cut out for programming".
>1. Write a C program that only... |
Forum: C++ 17 Days Ago |
| Replies: 7 Views: 232 >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... |