|
If I use short int and ReadFile() to read data from the port, it will be set up to read two bytes at a time. But the transmitting side is sending 9 bits of data only (with header and stuff, of course). Is it possible that I can read the 9th bit as a parity bit? But the thing is, I can't find any functions in VC++ to check for value of the parity bit or parity error-checking. If anyone knows about which function can perform the above, please post it. I greatly appreciate it. Thanx!
|
|
|
|
|
If you can read the 2 bytes in 2 characters
- if the 9th bit is the last bit (LSB) of second byte.
then logical and with 0x01 and if it's 0 then ur 9th bit is 0,
else if it's 1 - 9th bit is 1.
example : firstbyte = 0xf4
secondbyte = 0x01 (it can be either 1 or 0)
if(secondbyte & 0x01)
ninthbit = 1;
else
ninthbit = 0;
hope this helps..!
if you have further queries,post them..
thanks,
ravi
|
|
|
|
|
Hi,
How can i convert make file to a .dsw or .dsp file?
Thanks
Neha
|
|
|
|
|
I think you can try opening the MAK file.
can refer to documentation in MSDN
title : "Port a Project Made with NMAKE to the Development Environment"
From the File menu, click Open Workspace.
The Open Project Workspace dialog box appears.
In the Files of type drop-down list, select All Files (*.*) to display all files.
Select the drive and directory containing the previous makefile.
Select the makefile from the list of files and click OK.
Hope this helps.
thanks,
ravi.
|
|
|
|
|
I have created a Win32 program using Visual Studio .NET which I would like to put on another Win2K machine along with the debug symbols (.PDB file). I am trying to use the Dr Watson log to identify where a program is crashing but it refuses to include symbol information. The same setup on an WinXP workstation works fine and the Dr Watson log correctly gives me the function name that includes my deliberate bug.
Can anybody give me some information or point me at some information about about installing exe's and debug symbols. This is how we hope to diagnose problems on customer sites so I would really appreciate any information on the subject.
Steve.
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
find the article on this site about 'MiniDumps'. i think it's exactly what you want.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Thanks for replying. The article looks very interesting!
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
i want to change my dialog font's color!
|
|
|
|
|
Override the Dialog's OnCtlColor and use the SetTextColor function
|
|
|
|
|
It's in a List Control (the ones you can add on a dialog in the resource editor)
Thanks
|
|
|
|
|
from MSDN:
CListCtrl* pListCtrl = (CListCtrl*) GetDlgItem(IDC_YOURLISTCONTROL);
ASSERT(pListCtrl != NULL);
POSITION pos = pList->GetFirstSelectedItemPosition();
if (pos == NULL)
TRACE0("No items were selected!\n");
else
{
while (pos)
{
int nItem = pList->GetNextSelectedItem(pos);
TRACE1("Item %d was selected!\n", nItem);
}
}
-c
Cheap oil. It's worth it!
|
|
|
|
|
|
you'll need to use LVM_GETNEXTITEM with the LVIS_SELECTED param.
(you should probably say "non-MFC" in your questions. that way i won't give you MFC answers )
-c
Cheap oil. It's worth it!
|
|
|
|
|
Thankyou.
|
|
|
|
|
Is there any way to call a member function from another member function with for_each.... ie:
class foo {
void foo() {
// create vector of ints
std::for_each( vec.begin(), vec.end(), bar );
}
void bar( int val ) {
// do stuff with val
}
}
Ive tried various things for the third param to for_each, eg foo::bar, &foo::bar. It only works when the function is static.
Thanks
Ben
|
|
|
|
|
mem_fun_ref
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Can you expand a little on your answer? I have never heard of mem_fun_ref, what does it do? How do you use it?
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
It allows you to provide a member function to for_each
www.sgi.com has excellent STL docs, I'd only quote them, so better you go to the horses mouth, so to speak
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
THanks, I will check it out.
Thats usually where I go for my STL documentation anyway.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
foo::bar must be static, if not it expects the this pointer, which for_each cannot supply.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
mem_fun_ref and relatives have severe design flaws as for the const ness of their arguments, so you'll have to write some code yourself. The basic idea is to have an object presenting a normalized interface to for_each that forwards the call to the appropriate foo object and method. Just like this:
class foo
{
void foo()
{
std::for_each(vec.begin(),vec.end(),bar_stub(this));
}
void bar(int val)
{
...
}
struct bar_stub
{
bar_stub(foo* f):f(f){}
void operator(int val)
{
f->bar(val);
}
private:
foo* f;
};
};
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
The problem is not mem_fun_ref, but the implimentation in VC, I thought.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
Hi Christian! Well, the problem actually lies in bind1st (necessary to bind the 1st argument of mem_fun_ref to the object used,) whose signature is, according to the Standard Template Library Programmer's Guide:
template <class AdaptableBinaryFunction, class T>
binder1st<AdaptableBinaryFunction>
bind1st(const AdaptableBinaryFunction& F, const T& c); The const ness of the second parameter is what causes the problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
OK. I read an article in last months CUJ that led me to believe otherwise. I obviously did not read closely enough, or was feeling anti VC after finding out it does not impliment Koenig lookup properly.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
This time it is not VC++'s fault, but don't worry, we've got still plenty of stuff to blame it for
The bind1st and mem_fun problem is very well known among C++ geeks since long (do a search on the Usenet.) As always, Boost provides a remedy, check its Member Function Adapters section.
PS: Your sig is a real quotation?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|