我首先尝试使用javax.comm连接到串口(COM4).它甚至没有打开串口.
然后我尝试使用rxtx库(rxtx-2.2pre2)进行连接.它连接和写入数据但不从串行端口读取任何数据.
是否有任何JDK /平台依赖项使用javax.comm或rxtx库?
我使用:
的Windows XP SP3,
JDK 1.6.0_22,
RXTX-2.2pre2,
USB转串口适配器,
Portmon(微软) -监控串口的活动
超级终端-检查COM端口确实有效.
http://goo.gl/mNLNE - 用于检查读写的示例代码
如果您遇到类似我的类似问题,请告诉我.
任何帮助表示赞赏!
谢谢,J
我在一些书/教程中看到过这个。
当您将(链表的)头指针传递给函数时,您需要将其作为双指针传递。
例如: // 这是反向链表,其中 head 指向第一个节点。
void nReverse(digit **head)
{
digit *prev=NULL;
digit *curr=*head;
digit *next;
while(curr!=NULL)
{
next=curr->next;
curr->next=prev;
prev=curr;
curr=next;
}
*head=prev;
return;
}
Run Code Online (Sandbox Code Playgroud)
这工作正常。
当我使用单指针时它也有效,
void nReverse(digit *head)
{
digit *prev=NULL;
digit *curr=head;
digit *next;
while(curr!=NULL)
{
next=curr->next;
curr->next=prev;
prev=curr;
curr=next;
}
head=prev;
return;
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用头指针打印列表。这两个功能都可以正常工作。
我错过了什么吗?
谢谢,
我有一个Java接口的基本问题.
如果我有一个interface IA
和interface IB extends IA
现在,
class CK implements IB,
class CL implements IB,
class CM implements IB,
Run Code Online (Sandbox Code Playgroud)
......等
void foo(IA iFace) {
// I know how to check if iFace is of type CK/CL/CM ...
// Is it possible to check if iFace is of type IB ?
}
Run Code Online (Sandbox Code Playgroud)
希望我的问题很明确.
谢谢你的回复.
java ×2
c ×1
c++ ×1
inheritance ×1
interface ×1
javax.comm ×1
linked-list ×1
reverse ×1
rxtx ×1
serial-port ×1
windows ×1