Ah, yeah - forgot about those! Good call.
Type: Posts; User: Stuka
Ah, yeah - forgot about those! Good call.
I'd have to see more - it's been a while since I wrote the code to handle the serial port using those, and I have yet to successfully wrap any of my C++ in .NET. I'll dig up my code tomorrow and...
reserve() is handy for just such a thing - another potential improvement (though w/o having read in detail all of the thread, I could be off ;) ) would be to make your vector store pointers rather...
Strictly from the "My $0.02" department, I'd lose the separate arrays, and use a std::map<indexType, valueType>. That'll give you a LOT more efficiency.
From a C++ philosophy standpoint, why are you using 1) Dynamically allocated arrays vs. std::vector, and 2) Dual (presumably related, since you don't offer a count for both arrays) arrays rather than...
CaeZaR: What Magos said, with the additional recommendation that you drop C-style file input for C++ iostreams in C++ code. First off, IMHO it's much easier, and second, it's better integrated with...
Syneris: exactly - that's why I pointed him to Beej's tutorial. It's one of the better ones out there about explaining the whole TCP client/server process from a socket-level view that I've ever seen.
Your bitwise & in the conditional doesn't modify the flags set in any way. The expression returns a temporary boolean variable that's evaluated (as true in this case) and then disappears. Since flags...
You've only got one socket there - to do 2-way communication, you need 2 sockets - one is your server socket, which you bind() and recv() on, the other is your client socket, which you connect() with...
I have some old code lying about (at work) which accesses the COM port in Visual C++ 6 using CreateFile(). There was also an article in the MSDN magazine a couple of years back (I think - the mag's @...
laserlight: you're probably right on that - I was reading and typing fast, and it's late. As for the brackets, I'd suspect you're right, but since we haven't seen that code, it's hard to judge. I...
The problem you have while using &MyClass::ThreadFunc (which , btw, is what you really WANT to use), is that MyClass::ThreadFunc doesn't actually match the function signature of the ThreadFunc...
Aw, heck, let's start 2 holy wars in one thread! Use vim! *dons flame-proof suit*
It's POSSIBLE, but it's not easy. You'd need an OS-level app to do it, since accessing memory outside an app's allocated space typically results in a segfault - or a General Protection Fault in Win32...
You shouldn't need those brackets. Your error is caused because the << operator on an ostream, by default, stops on whitespace.
I'm not an expert - just read a CUJ article on typename not to long ago. The reason, I think, is because of the additional scoping operator in there, and the way the compiler looks up names. It just...
<quibble> If the variable extention is a std::string, you can do that comparison, because the literal string will be converted implicitly</quibble>
I *think* this is where you need the typename keyword, like so:
MOO(typename std::vector<T>::iterator m) Basically, because of templating, the compiler doesn't realize that std::vector<T> is a...
<off topic>And is there something wrong with being lazy and antisocial? I *am* a programmer!</off topic>
You're trying to pass the literal string "VK_A" (or b, or whatever) - what the function wants is the symbolic constant VK_A
Personally, when I want random access I use a std::vector, not an array :-P
That's a check for valid input. The function expects iPos (passed in by the function's caller) to be >= 1. If it's not, the function bails out rather than running with bad data.
In addition, on platforms where there is no difference beteween text and binary files (Unix/Linux for example), ios::binary is unneccessary.
The first thing I'd try is checking argv[1] - in normal console mode, argv[0] is the program name, and argv[1] is the first argument passed. The Windows GUI typically invokes programs by calling them...
_inp and _outp are most likely failing because they compile to assembly instructions that only the OS is allowed to use, and your program is running in userspace. With the VC++ code, you used OS...