Hi,
i always resolve an "arrow up" instead an "A" when i do this (snipped!):
BYTE Byte;
Byte = 0x41;
PortWrite((BYTE)(&Byte));
BOOL PortWrite (BYTE Byte)
{
WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL);
return TRUE;
}
what is the problem?
thx martin 8 2419
* Martin Petzold <mp******@gmx.net> schriebt:
This is off-topic in [comp.lang.c++].
Perhaps try [comp.os.ms-windows.programmer.win32]?
See the FAQ for some other possibilities & posting guidelines.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
Martin Petzold <mp******@gmx.net> spoke thus: i always resolve an "arrow up" instead an "A" when i do this (snipped!):
What Mr. Steinbach said, and also never multi-post again.
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Martin Petzold wrote: I always resolve an "arrow up" instead an "A" when i do this (snipped!):
BYTE Byte;
Byte = 0x41; PortWrite((BYTE)(&Byte));
BOOL PortWrite (BYTE Byte) { WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL); return TRUE; }
what is the problem?
You don't know what you are doing.
It appears that you are attempting to write the address of a BYTE
which contains the value 0x41.
On Mon, 12 Apr 2004 18:14:56 GMT in comp.lang.c++, al***@start.no (Alf
P. Steinbach) wrote, * Martin Petzold <mp******@gmx.net> schriebt:
This is off-topic in [comp.lang.c++].
No it's not. The difference between a char, and the address of a char,
and the address of an array of chars, is not to be ignored in any
standard implementation of C++.
"Martin Petzold" <mp******@gmx.net> wrote in message
news:c5**********@newsreader2.netcologne.de... Hi, i always resolve an "arrow up" instead an "A" when i do this (snipped!):
BYTE Byte;
Byte = 0x41; PortWrite((BYTE)(&Byte));
BOOL PortWrite (BYTE Byte) { WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL); return TRUE; }
what is the problem?
thx martin
Assuming that WriteFile requires an address as the second parameter, and a
size as the third parameter, you are writing the size of an address rather
than the size of a byte.
Perhaps this will fix it:
WriteFile (hPort, &Byte, sizeof (Byte), NULL, NULL);
"Martin Petzold" <mp******@gmx.net> wrote in message
news:c5**********@newsreader2.netcologne.de... Hi, i always resolve an "arrow up" instead an "A" when i do this (snipped!):
BYTE Byte;
Byte = 0x41; PortWrite((BYTE)(&Byte));
PortWrite takes a BYTE, not a pointer to a BYTE, so just pass it Byte, not
the address of Byte. BOOL PortWrite (BYTE Byte) { WriteFile (hPort, &Byte, sizeof (&Byte), NULL, NULL);
If you're intending to write the value stored in Byte, then the size you
probably want is sizeof(BYTE), not the size of the address of the variable.
return TRUE; }
what is the problem?
thx martin
Perhaps you want this?
PortWrite(Byte);
....
BOOL PortWrite( BYTE Byte )
{
WriteFile( hPort, &Byte, sizeof(BYTE), NULL, NULL );
....
}
?
-Howard al***@start.no (Alf P. Steinbach) wrote in message news:<40****************@news.individual.net>... * Martin Petzold <mp******@gmx.net> schriebt:
This is off-topic in [comp.lang.c++].
Perhaps try [comp.os.ms-windows.programmer.win32]?
See the FAQ for some other possibilities & posting guidelines.
Aside from the fact that you're OT, you should use "sizeof(Byte)"
instead of "sizeof(&Byte)". This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dan |
last post by:
I wnat to see in browser an status from an device connected on rs232
port
The java class for read from serial port is:
//Serial.java
import java.io.*;
import java.util.*;
import java.lang.*;
import javax.comm.*;
|
by: Bob Greschke |
last post by:
We have some equipment that communicates at 57600 baud RS232. The path from
the PC is USB to a Phillips USB hub, then off of that a TUSB3410 USB/Serial
converter. The driver for the 3410 chip creates a "normal" comm port (like
COM3). There is a C++ program that has no problem talking to the equipment,
but two Python programs have trouble. ...
|
by: Martin Petzold |
last post by:
Hi,
i always receive an "arrow up" instead an "A" when i do this (snipped!):
BYTE Byte;
Byte = 0x41;
PortWrite((BYTE)(&Byte));
BOOL PortWrite (BYTE Byte)
{
|
by: Terry Olsen |
last post by:
I'm trying to use the RS232 class that was in the Platform SDK (i think).
Has anyone else used this with events successfully? Here's what i've got:
======================
Public WithEvents bbsPort As Rs232 = New Rs232
With bbsPort
.BaudRate = baud
.DataBit = dataBits
.Parity = parity
.Port = comPort
|
by: Tony Papadimitriou |
last post by:
Hi all,
I've written an app using RS232.VB (by Keith Langer 2/5/02 -- Modified to
handle overlapped IO and provide asynchronous read/write) and the executable
works as expected under XP Pro but, the RS232 portion of the app doesn't
work under Win98SE.
Any ideas?
TIA
| |
by: jay.dow |
last post by:
I want to write to the pins of an RS232 without using the serial
protocol. The use would be every pin could act to complete a circuit
in customized hardware. I could use python to communicate serially to
a BASIC stamp or a Javelin stamp and then use the stamp to set however
many pins as 0's or 1's but should it be that hard to do with...
|
by: jyotish.bora |
last post by:
Hi ,
i m trying to send a message packet to a RS232 port. I have created the
handle and set the parameters. Now the general format of the packet is
<STX>command<ETX><LRC>
I have also written the code to calculate <LRC>.
now i dont understand how to make the packet string. should i call
writefile with STX, command , ETX and LRC characters...
|
by: j.aloussi |
last post by:
Hello,
I am developing a serial-communication application for a pocket-PC and
a PC.
I am trying to make a serial-port connection via Bluetooth. All goes
well: Bluetooth connection and COM ports starting at both sides.
The problem is by sending Data via the COM port.
For example whenn I send: "Foo Data to send". I receive at the other
|
by: zektor |
last post by:
Hi there, I have an application that have 1 backgroundworker doing operation in hw through rs232 (like a pooling constantly). In my UI thread I have do operations also on that resource (rs232 resource).
The problem: When I click a button to send data over th rs232 and the worker is doing Some operation (backWorker.IsBusy == true) I send a...
|
by: Xavier |
last post by:
Hi,
I try to access to a Bluetooth GPS data-logger with Python. I use
pySerial.
Sending and receiving little messages (~100 char) works fine. However,
when I ask the GPS to dump the trails, it returns some Mbytes and here
is the problem : in the stream of bytes, I randomly losts chunks of
~100bytes.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |