|
Just for a short time while we upgrade them to a cluster of Mac Pros rather than Mac Minis
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
|
Welcome in the THHB [^], [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Welcome in the THHB [^], [^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I tried using shared pointer in VS 2008 trial edition(Team suite) in a Win32 application,
#include "stdafx.h"
#include <memory>
int _tmain(int argc, _TCHAR* argv[])
{
std::tr1::hexfloat //Only this comes in tr1 namesspace
std::tr1::shared_ptr sharedPtr;
//std::tr1:: error C2039: 'shared_ptr' : is not a member of 'std::tr1'
return 0;
}
It’s supporting auto_ptr but not shared_ptr. Is the problem in my coding or because of trial version.
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Could be the trial version - I seem to remember tr1 only got added to VS2008 in service pack 1 or with the Visual C++ 2008 Feature Pack[^].
Anyway - std::tr1::shared_ptr works fine for me on VS2008 with service pack 1 installed.
PS - you'll need to tell shared_ptr (as a template parameter) what type it's pointing at!!!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello I want to read from com port1, and I used API
if (WaitCommEvent(hSerial, &dwCommEvent,NULL))
{
if (dwCommEvent & EV_RXCHAR)
{
DWORD dwNumberBytesRead;
if(ReadFile(hSerial, chRead, sizeof(chRead),&dwNumberBytesRead,&osReader))
I have got an extra Thread to read com port but if data is not send to port my program hangs up.
Is there any way to check if input buffer is changed and then ReadFile instead waiting for
WaitCommEvent ??, or if there is some other ways?
Thanks in advace
|
|
|
|
|
komofilms77 wrote: ...or if there is some other ways?
See here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
When I've programmed serial ports, I've not used WaitCommEvent - I've set a timeout period with SetCommTimeouts [^] and just used ReadFile . If the serial port receives data or times out, then ReadFile returns successfully and will tell you how many bytes it received (0 probably indicates a timeout).
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I want to convert a cstring into LPBYTE but each time i convert it only first character get stored in the LPBYTE and rest of the string is truncated.
Thanks
amit
|
|
|
|
|
First important point: why do you want to do such a thing ? Are you aware about unicode/non-unicode ? If not, I highly suggest reading this article[^] before going further.
Post also your code to see what you are doing wrong.
|
|
|
|
|
Hi .. thanks for prompt reply. I am getting a file in cstring and i want to parse. The parser take the data in LPBYTE format and file data contain few words in languge other than english thats why i am taking cstring to store it. But when i convert cstring to lpbyte only first character get stores. Meanwhile i am going through the link you have sent.
amit
|
|
|
|
|
amit.code wrote: I want to convert a cstring into LPBYTE...
How are you doing it? Something like:
CString name("Name");
const LPBYTE lp = (const LPBYTE) (LPCSTR) name; amit.code wrote: ...but each time i convert it only first character get stored in the LPBYTE and rest of the string is truncated.
How are you verifying this?
Is Unicode defined?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Yes .. i have also tried the method that you mentioned. I am parsing that whole data that comes in lpbyte but it shows only one character. During debugging I am verifying it also throughg watch window.
Thanks
amit
|
|
|
|
|
Could it be that you are feeding a unicode string to something that expects a simple ASCII string? Also note, that LPBYTE is porbably not recognized as a string by the debugger, thus it will only show you the pointer's value (the address it is pointing at) and maybe the one byte it is pointing at.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
hi.. thanks for reply. You are right in your first point, when i convert cstring to string and than pass it to LPBYTE than whole data is being assigned and yes we can see the whole data during debug in lpbyte but during conversation from cstring to string data not written in english language being wrongly modified and there what i am getting problem. Thats why I am trying to convert cstring directly to lpbyte.
Thanks
amit
|
|
|
|
|
Then -as other people already pointed out- please show us how you actually do the conversion.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Try this.
BYTE string[MAX_PATH];
::WideCharToMultiByte(CP_ACP, 0, (LPCTSTR)cstring, -1, (LPSTR)string, MAX_PATH, 0, 0);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for reply.. i have tried your suggestion but it fails to convert character of other language. Meanwhile i found a workaround solution of this one.
amit
|
|
|
|
|
Nice change to ACTUALLY see a code example that actually works...
Too many times I have to weed out the trash where people don't have the common courtesy of showing an actual code example.
They beat the dead horse to death without any clue to help those that aren't intimately familiar with all the ins and outs of C!
Thanks "Superman"!
---
Most of my programming of the last 5 to 10 years has been in Visual Basic where strings are strings.
C++ has so damn many string types that it is very easy to get confused when converting the different flavors of strings to anything and back.
If I had my way, more people would learn to program in Assembly where data is data and you have to determine what to do with it.
My first programming job for the first 5 to 7 years was purely in Assembly Language. I learned a bunch of things very quickly that way.
We all too lazy in the last 20 years it seems when programming.
Bill G.
Senior Software Engineer / Systems Analyst for over 32 years.
Age 53
|
|
|
|
|
I have an application developed in VC++6.0 using MFC MDI application type. I want to convert my application to VC++.NET.
Pls List out the steps about how to convert my application to VC++.NET?
Also Provide me any automation tools for converting the VC++6.0 application to VC++.NET (i.e., converting the .DSP, .DSW files to .SLN files in .NET)
|
|
|
|
|
What does it tell you when you try to a open VC6 solution with a VC++.net IDE?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
- Open up the 6.0 DSW (or DSP) of your project in Visual Studio.NET (year of your choice) and the IDE will ask you
to convert the project files.
- Click Yes/OK
- Once that is done, save, and rebuild your project.
- Fix all the new errors and warnings.
- Test your application.
This signature was proudly tested on animals.
|
|
|
|
|
Is there any automatic tool for doing this conversion.
|
|
|
|
|
Do you want to convert your MFC application into a .NET application ? Then one can activate the /CLR compiler switch and it will compile it as managed C++.
http://msdn.microsoft.com/en-us/ms173265.aspx
Later you can convert your managed C++ into C#, and change your MFC dialogs into WinForms.
Or do you just want to upgrade to a newer version of Visual studio ? If so then Visual Studio will automatically upgrade the project files of you MFC application. And you might have to resolve some issues as the C++ compiler is more standard compliant.
|
|
|
|