求助!引发了异常: 读取访问权限冲突。s 是 0xCCCCCCCC。

qq_38870629 2017-05-25 06:39:11
#include "stdio.h"
#include "math.h"
#include "stdlib.h" //exit()
typedef int DataType;
#include "malloc.h" //malloc()

typedef struct Node
{
DataType data;
struct Node *next;
} SLNode;

void ListInitiate(SLNode **head)
{
if ((*head = (SLNode *)malloc(sizeof(SLNode))) == NULL) exit(1);
(*head)->next = NULL;
}

//在带头节点的单链表head的第i(0<=i<=size)个结点前插入
int ListInsert(SLNode * head, int i, DataType x)
{
SLNode *p, *q;
int j;

p = head;
j = -1;
//其实就是i-1-(-1)=i次,把p指针移到第i-1个结点上,因为结点从0开始
while (p->next != NULL && j < i - 1)
{
p = p->next;
j++;
}

if (j != i - 1)
{
printf("insert error !/n");
return 0;
}

if ((q = (SLNode *)malloc(sizeof(SLNode))) == NULL) exit(1);
q->data = x;

q->next = p->next;
p->next = q;
return 1;

}

//释放动态申请的内存空间
void Destroy(SLNode * *head)
{
SLNode *p, *p1;
p = *head;
while (p != NULL)
{
p1 = p;
p = p->next;
free(p1);
}
*head = NULL;
}
void Buildloop(SLNode *head, SLNode *head2, DataType m, DataType n)
{
int flag1 = 0, flag2 = 0;
SLNode *p, *q, *r, *s;
p = head->next;
q = head2;

while (p != NULL)
{
if (p->data ==m ) {
flag1++;
if (flag1 == 1) {
r = (SLNode *)malloc(sizeof(SLNode));
r->data = m;
r->next = p->next;


}
}
if (p->data == n) {
flag2++;
if (flag2 == 1) {
s = (SLNode *)malloc(sizeof(SLNode));
s->data = n;
s->next = p->next;
//s = p;
}
if (flag1 == 1 && flag2 == 1)
break;

}
/*if (s->next = NULL) {
s->next = r;
}*/

head2->next = s->next;
s->next = r;

while (q->next != NULL) {
q = q->next;
}
q->next = r;



}
}
int FindLoopNode(SLNode *head, int j)
{
int i = j, begin = 1;
SLNode *fast = head, *slow = head;
for (i; i > 0; i--) {
fast = fast->next;
}
slow = head;
while (slow != fast) {
begin++;
slow = slow->next;
fast = fast->next;
}
return begin;
}


int IsExitsloop(SLNode *head)
{
SLNode *slow = head;
SLNode *fast = head;
int i, j = 1;

while (fast&&fast->next)
{
slow = slow->next;
fast = fast->next->next;
if (slow == fast)break;
}
if (fast == NULL || fast->next == NULL) {
printf("该链表不存在环!\n");
}
else {
printf("该链表存在环!\n");
while (fast&&fast->next) {
slow = slow->next;//fast与slow相遇后,slow并没有遍历完链表,继续遍历
j++;
if (slow->next == fast)break;
}
}
i = FindLoopNode(head, j);
printf("环的起始位置为:%d\n", i);
printf("环的结束位置为:%d\n", j + i - 1);
return 0;
}
int ListLength(SLNode *head)
{
SLNode *slow = head->next, *fast = head->next;
int length = 1;
while (fast&&fast->next) {
slow = slow->next;
fast = fast->next->next;
if (slow == fast)
{
while (fast&&fast->next)
{
slow = slow->next;
length++;
if (slow->next == fast)break;
}
break;
}
}
return length;
}
void ReList(SLNode *head)
{
SLNode *p = head, *q = head;
int length = ListLength(head);
for (; length > 0; length--)p = p->next;
while (p != q)
{
q = q->next;
if (p->next == q)
{
p->next = NULL;
break;
}
p = p->next;
}
}
void IsIntersect(SLNode *head, SLNode *head2)
{
SLNode *p, *q;
p = head;
q = head2;
int i = 0, flag = 0;
while (p->next != NULL)
{
i++;
p = p->next;
while (q->next != NULL)
{
q = q->next;
if (p == q) {
flag = 1;
printf("链表存在相交位置,位置为%d\n",i);
break;
}
}
if (flag == 1)break;
}
if (flag != 1)
printf("链表不相交!");
}
#pragma once

...全文
1374 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2017-05-26
  • 打赏
  • 举报
回复
崩溃的时候在弹出的对话框按相应按钮进入调试,按Alt+7键查看Call Stack即“调用堆栈”里面从上到下列出的对应从里层到外层的函数调用历史。双击某一行可将光标定位到此次调用的源代码或汇编指令处,看不懂时双击下一行,直到能看懂为止
赵4老师 2017-05-26
  • 打赏
  • 举报
回复
仅供参考:
//不带表头结点的单向链表
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
#include <time.h>
#include <locale.h>
struct NODE {
    int          data;
    struct NODE *next;
} *head,*p,*q,*s,*p1,*p2,*q1,**ta;
int i,k,n,t,m,v,N=10;
int main() {
    setlocale(LC_ALL,"chs");
    srand(time(NULL));

    head=NULL;

    printf("创建%d个节点的单链表:",N);//创建N个节点的单链表
    p=head;
    for (i=0;i<N;i++) {
        q=(struct NODE *)malloc(sizeof(struct NODE));
        if (NULL==q) exit(1);
        q->data=rand()%100;//填写0..99的随机值
        q->next=NULL;
        if (NULL==p) {
            head=q;
            p=head;
        } else {
            p->next=q;
            p=q;
        }
    }

    //输出整个单链表
    s=head;
    while (1) {
        if (NULL==s) {
            printf("\n");
            break;
        }
        printf("%02d->",s->data);
        s=s->next;
    }

    k=3;
    v=5;
    printf("将值为%d的结点插入到单链表的第%d个结点前:",v,k);//将值为v的结点插入到单链表的第k个结点前
    n=0;
    p=head;
    while (1) {
        if (NULL==p) {
            break;
        }
        n++;
        if (k==1) {
            q=(struct NODE *)malloc(sizeof(struct NODE));
            if (NULL==q) exit(1);
            q->data=v;
            q->next=head;
            head=q;
            break;
        } else {
            if (k-1==n) {
                q=(struct NODE *)malloc(sizeof(struct NODE));
                if (NULL==q) exit(1);
                q->data=v;
                q->next=p->next;
                p->next=q;
                break;
            }
        }
        p=p->next;
    }

    //输出整个单链表
    s=head;
    while (1) {
        if (NULL==s) {
            printf("\n");
            break;
        }
        printf("%02d->",s->data);
        s=s->next;
    }

    k=5;
    printf("删除第%d个节点:",k);//删除第k个节点
    n=0;
    p=head;
    while (1) {
        if (NULL==p) {
            break;
        }
        n++;
        if (k==1) {
            q=head;
            head=head->next;
            free(q);
            break;
        } else {
            if (k-1==n) {
                q=p->next;
                if (q) {
                    p->next=q->next;
                    free(q);
                }
                break;
            }
        }
        p=p->next;
    }

    //输出整个单链表
    s=head;
    while (1) {
        if (NULL==s) {
            printf("\n");
            break;
        }
        printf("%02d->",s->data);
        s=s->next;
    }

    printf("从小到大排序:");//从小到大排序
    for (p=head,p1=NULL;p!=NULL;p1=p,p=p->next) {
        for (q=p->next,q1=p;q!=NULL;q1=q,q=q->next) {
            if (p->data > q->data) {

                //交换data
//              printf("swap %02d %02d\n",p->data,q->data);
//              t=p->data;p->data=q->data;q->data=t;

                //或者

                //交换next
//              printf("swap %02d %02d\n",p->data,q->data);
                if (p==head) {//p是头
                    if (p->next==q) {//pq挨着
                        head=q;
                        p->next=q->next;
                        q->next=p;
                        q=p;
                        p=head;
                    } else {//pq不挨着
                        head=q;
                        p2=p->next;
                        p->next=q->next;
                        q->next=p2;
                        q1->next=p;
                        q=p;
                        p=head;
                    }
                } else {//p不是头
                    if (p->next==q) {//pq挨着
                        p1->next=q;
                        p->next=q->next;
                        q->next=p;
                        q=p;
                        p=p1->next;
                    } else {//pq不挨着
                        p1->next=q;
                        p2=p->next;
                        p->next=q->next;
                        q->next=p2;
                        q1->next=p;
                        q=p;
                        p=p1->next;
                    }
                }

                //输出整个单链表
//              s=head;
//              while (1) {
//                  if (NULL==s) {
//                      printf("\n");
//                      break;
//                  }
//                  printf("%02d->",s->data);
//                  s=s->next;
//              }
//              getchar();
            }
        }
    }

    //输出整个单链表并计算链表长度n
    n=0;
    s=head;
    while (1) {
        if (NULL==s) {
            printf("\n");
            break;
        }
        printf("%02d->",s->data);
        n++;
        s=s->next;
    }

    printf("将整个链表逆序:");//将整个链表逆序
    if (n>=2) {
        p=head;
        q=p->next;
        p->next=NULL;
        while (1) {
            q1=q->next;
            q->next=p;
            p=q;
            q=q1;
            if (NULL==q) break;
        }
        head=p;
    }

    //输出整个单链表
    s=head;
    while (1) {
        if (NULL==s) {
            printf("\n");
            break;
        }
        printf("%02d->",s->data);
        s=s->next;
    }

    m=4;
    n=6;
    printf("将单链表中前%d个结点和后%d个结点进行互换:",m,n);//将单链表中前m个结点和后n个结点进行互换,m+n为链表总长
    k=0;
    p=head;
    while (1) {
        if (NULL==p) {
            break;
        }
        k++;
        if (m==k) {
            q=p;
        }
        s=p;
        p=p->next;
    }
    q1=head;
    head=q->next;
    s->next=q1;
    q->next=NULL;

    //输出整个单链表
    s=head;
    while (1) {
        if (NULL==s) {
            printf("\n");
            break;
        }
        printf("%02d->",s->data);
        s=s->next;
    }

    //释放所有节点
    p=head;
    while (1) {
        if (NULL==p) {
            break;
        }
        q=p->next;
        free(p);
        p=q;
    }

    return 0;
}
//创建10个节点的单链表:08->74->07->23->03->99->31->56->88->16->
//将值为5的结点插入到单链表的第3个结点前:08->74->05->07->23->03->99->31->56->88->16->
//删除第5个节点:08->74->05->07->03->99->31->56->88->16->
//从小到大排序:03->05->07->08->16->31->56->74->88->99->
//将整个链表逆序:99->88->74->56->31->16->08->07->05->03->
//将单链表中前4个结点和后6个结点进行互换:31->16->08->07->05->03->99->88->74->56->
//
zgl7903 2017-05-26
  • 打赏
  • 举报
回复
cc 分配了但是未被初始化的内存区域
  • 打赏
  • 举报
回复
引用 楼主 qq_38870629 的回复:
#include "stdio.h" #include "math.h" #include "stdlib.h" //exit() typedef int DataType; #include "malloc.h" //malloc() typedef struct Node { DataType data; struct Node *next; } SLNode; void ListInitiate(SLNode **head) { if ((*head = (SLNode *)malloc(sizeof(SLNode))) == NULL) exit(1); (*head)->next = NULL; } //在带头节点的单链表head的第i(0<=i<=size)个结点前插入 int ListInsert(SLNode * head, int i, DataType x) { SLNode *p, *q; int j; p = head; j = -1; //其实就是i-1-(-1)=i次,把p指针移到第i-1个结点上,因为结点从0开始 while (p->next != NULL && j < i - 1) { p = p->next; j++; } if (j != i - 1) { printf("insert error !/n"); return 0; } if ((q = (SLNode *)malloc(sizeof(SLNode))) == NULL) exit(1); q->data = x; q->next = p->next; p->next = q; return 1; } //释放动态申请的内存空间 void Destroy(SLNode * *head) { SLNode *p, *p1; p = *head; while (p != NULL) { p1 = p; p = p->next; free(p1); } *head = NULL; } void Buildloop(SLNode *head, SLNode *head2, DataType m, DataType n) { int flag1 = 0, flag2 = 0; SLNode *p, *q, *r, *s; p = head->next; q = head2; while (p != NULL) { if (p->data ==m ) { flag1++; if (flag1 == 1) { r = (SLNode *)malloc(sizeof(SLNode)); r->data = m; r->next = p->next; } } if (p->data == n) { flag2++; if (flag2 == 1) { s = (SLNode *)malloc(sizeof(SLNode)); s->data = n; s->next = p->next; //s = p; } if (flag1 == 1 && flag2 == 1) break; } /*if (s->next = NULL) { s->next = r; }*/ head2->next = s->next; s->next = r; while (q->next != NULL) { q = q->next; } q->next = r; } } int FindLoopNode(SLNode *head, int j) { int i = j, begin = 1; SLNode *fast = head, *slow = head; for (i; i > 0; i--) { fast = fast->next; } slow = head; while (slow != fast) { begin++; slow = slow->next; fast = fast->next; } return begin; } int IsExitsloop(SLNode *head) { SLNode *slow = head; SLNode *fast = head; int i, j = 1; while (fast&&fast->next) { slow = slow->next; fast = fast->next->next; if (slow == fast)break; } if (fast == NULL || fast->next == NULL) { printf("该链表不存在环!\n"); } else { printf("该链表存在环!\n"); while (fast&&fast->next) { slow = slow->next;//fast与slow相遇后,slow并没有遍历完链表,继续遍历 j++; if (slow->next == fast)break; } } i = FindLoopNode(head, j); printf("环的起始位置为:%d\n", i); printf("环的结束位置为:%d\n", j + i - 1); return 0; } int ListLength(SLNode *head) { SLNode *slow = head->next, *fast = head->next; int length = 1; while (fast&&fast->next) { slow = slow->next; fast = fast->next->next; if (slow == fast) { while (fast&&fast->next) { slow = slow->next; length++; if (slow->next == fast)break; } break; } } return length; } void ReList(SLNode *head) { SLNode *p = head, *q = head; int length = ListLength(head); for (; length > 0; length--)p = p->next; while (p != q) { q = q->next; if (p->next == q) { p->next = NULL; break; } p = p->next; } } void IsIntersect(SLNode *head, SLNode *head2) { SLNode *p, *q; p = head; q = head2; int i = 0, flag = 0; while (p->next != NULL) { i++; p = p->next; while (q->next != NULL) { q = q->next; if (p == q) { flag = 1; printf("链表存在相交位置,位置为%d\n",i); break; } } if (flag == 1)break; } if (flag != 1) printf("链表不相交!"); } #pragma once
s->next = r;这里的s指针可能还是NULL,赋值前最后判定下,因前面s = (SLNode *)malloc(sizeof(SLNode));这句不一定执行到。
yi19861209 2017-05-25
  • 打赏
  • 举报
回复
自信男孩 2017-05-25
  • 打赏
  • 举报
回复
head2->next = s->next;
        s->next = r;
这里,如果if (p->data == n)条件不满足,那么s->next肯定是有问题的,所以这儿有潜在的bug. 做如下修改,试试:
void  Buildloop(SLNode *head, SLNode *head2, DataType m, DataType n)
{
    int flag1 = 0, flag2 = 0;
    SLNode *p, *q, *r = NULL, *s = NULL;
    p = head->next;
    q = head2;

    while (p != NULL)
    {
        if (p->data ==m ) {
            flag1++;
            if (flag1 == 1) {
                r = (SLNode *)malloc(sizeof(SLNode));
                r->data = m;
                r->next = p->next;


            }
        }
        if (p->data == n) {
            flag2++;
            if (flag2 == 1) {
                s = (SLNode *)malloc(sizeof(SLNode));
                s->data = n;
                s->next = p->next;
                //s = p;
            }
            if (flag1 == 1 && flag2 == 1)
                break;

        }
        /*if (s->next = NULL) {
          s->next = r;
          }*/
        if (s) {    /*判断一下s*/
            head2->next = s->next;
            s->next = r;
        }


        while (q->next != NULL) {
            q = q->next;
        }
        q->next = r;
    }
}
qq_38870629 2017-05-25
  • 打赏
  • 举报
回复
#include "stdio.h" #include "stdlib.h" //exit() #include "malloc.h" //malloc() typedef int DataType; #include "NLinlist.h" int main() { char a = 'Y'; SLNode *head, *head2, *p,*q; int i,j, number, ii, m, n; //int ninsertx, ninserty, ndeletex, npreviousx, ninsertm, ninsertn; //初始化链表 ListInitiate(&head); ListInitiate(&head2); printf("请输入链表的数据元素个数:\n"); scanf("%d", &number); printf("\n请一个一个的输入元素值:\n"); for (i = 0; i < number; i++) { scanf("%d", &ii); ListInsert(head, i, ii); } printf("你输入的链表是:\n"); p = head->next; while (p != NULL) { printf("%d ", p->data); p = p->next; } printf("\n请输入要成环的两个元素的值:\n"); scanf("%d%d", &m,&n); //printf("%d%d", m, n); //scanf("%d", &n); Buildloop(head, head2, m, n); /*p = head->next; q = head2->next; while (q != NULL) { printf("%d ", p->data); p = p->next; printf("%d ", q->data); q = q->next; }*/ FindLoopNode(head,j); IsExitsloop(head); ListLength(head); ReList(head); IsIntersect(head, head2); } 这里
自信男孩 2017-05-25
  • 打赏
  • 举报
回复
你的main函数呢?
CSerialPort First Version by Remon Spekreijse on 2000-02-08 http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/c2483/A-communication-class-for-serial-port.htm Second Version by mrlong on 2007-12-25 https://code.google.com/p/mycom/ 增加 ClosePort 增加 WriteToPort 两个方法 增加 SendData 与 RecvData 方法 by liquanhai on 2011-11-04 http://blog.csdn.net/liquanhai/article/details/4955253 增加 ClosePort 中交出控制权,防止死锁问题 by liquanhai on 2011-11-06 http://blog.csdn.net/liquanhai/article/details/6941574 增加 ReceiveChar 中防止线程死锁 by viruscamp on 2013-12-04 https://github.com/viruscamp/CSerialPort 增加 IsOpen 判断是否打开 修正 InitPort 中 parity Odd Even 参数取值错误 修改 InitPort 中 portnr 取值范围,portnr>9 时特殊处理 取消对 MFC 的依赖,使用 HWND 替代 CWnd,使用 win32 thread 函数而不是 MFC 的 增加用户消息编号自定义,方法来自 CnComm by itas109 on 2014-01-10 http://blog.csdn.net/itas109/article/details/18358297 解决COM10以上端口无法显示的问题 扩展可选择端口,最大值MaxSerialPortNum可以自定义 添加QueryKey()和Hkey2ComboBox两个方法,用于自动查询当前有效的串口号。 by liquanhai on 2014-12-18 增加一些处理措施,主要是对减少CPU占用率 by itas109 on 2016-05-07 http://blog.csdn.net/itas109 修复每次打开串口发送一次,当串口无应答时,需要关闭再打开或者接收完数据才能发送的问题。 解决办法:在m_hEventArray中调整m_hWriteEvent的优先级高于读的优先级。CommThread(LPVOID pParam)函数中读写的位置也调换。 参考:http://zhidao.baidu.com/link?url=RSrbPcfTZRULFFd2ziHZPBwnoXv1iCSu_Nmycb_yEw1mklT8gkoNZAkWpl3UDhk8L35DtRPo5VV5kEGpOx-Gea 修复停止位在头文件中定义成1导致SetCommState报错的问题,应为1对应的停止位是1.5。UINT stopsbits = ONESTOPBIT switch(stopbits)和switch(parity)增加默认情况,增强程序健壮性 by itas109 on 2016-06-22 http://blog.csdn.net/itas109 增加ReceiveStr方法,用于接收字符串(接收缓冲区有多少字符就接收多少字符)。 解决ReceiveChar只能接收单个字符的问题。 by itas109 on 2016-06-29 http://blog.csdn.net/itas109 解决RestartMonitoring方法和StopMonitoring方法命令不准确引起的歧义,根据实际作用。 将RestartMonitoring更改为ResumeMonitoring,将StopMonitoring更改为SuspendMonitoring。 增加IsThreadSuspend方法,用于判断线程是否挂起。 改进ClosePort方法,增加线程挂起判断,解决由于线程挂起导致串口关闭死锁的问题。 增加IsReceiveString宏定义,用于接收时采用单字节接收还是多字节接收 by itas109 on 2016-08-02 http://blog.csdn.net/itas109 https://github.com/itas109 改进IsOpen方法,m_hComm增加INVALID_HANDLE_VALUE的情况,因为CreateFile方法失败返回的是INVALID_HANDLE_VALUE,不是NULL 改进ClosePort方法:增加串口句柄无效的判断(防止关闭死锁);m_hWriteEvent不使用CloseHandle关闭 改进CommThread、ReceiveChar、ReceiveStr和WriteChar方法中异常处理的判断,增加三种判断:串口打开失败(error code:ERROR_INVALID_HANDLE)、连接过程中非法断开(error code:ERROR_BAD_COMMAND)和拒绝访问(error code:ERROR_ACCESS_DENIED) 采用安全函数sprintf_s和strcpy_s函数替换掉sprintf和strcpy 改进QueryKey方法,用于查询注册表的可用串口值,可以搜索到任意的可用串口 改进InitPort方法,串口打开失败,增加提示信息:串口不存在(error code:ERROR_FILE_NOT_FOUND)和串口拒绝访问(error code:ERROR_ACCESS_DENIED) 加入viruscamp 取消对 MFC 的依赖 改进InitPort方法,如果上次串口是打开,再次调用InitPort方法,关闭串口需要做一定的延时,否则有几率导致ERROR_ACCESS_DENIED拒绝访问,也就是串口占用问题 初始化默认波特率修改为9600 修复一些释放的BUG 规范了一些错误信息,参考winerror.h -- error code definitions for the Win32 API functions 删除SendData和RecvData方法 by itas109 on 2016-08-10 http://blog.csdn.net/itas109 https://github.com/itas109 改进ReceiveStr方法,comstat.cbInQue = 0xcccccccc的情况(如串口异常断开),会导致RXBuff初始化失败 by itas109 on 2017-02-14 http://blog.csdn.net/itas109 https://github.com/itas109 兼容ASCII和UNICODE编码 ReceiveStr函数中发送函数SendMessage的第二个参数采用结构体形式,包括portNr串口号和bytesRead读取的字节数,可以处理16进制的时候0x00截断问题 精简不必要的函数SendData和RecvData 尽量的取消对 MFC 的依赖,Hkey2ComboBox函数暂时保留 其他小问题修改 博客:blog.csdn.net/itas109 Email:itas109@qq.com
CSerialPort First Version by Remon Spekreijse on 2000-02-08 http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/c2483/A-communication-class-for-serial-port.htm Second Version by mrlong on 2007-12-25 https://code.google.com/p/mycom/ 增加 ClosePort 增加 WriteToPort 两个方法 增加 SendData 与 RecvData 方法 by liquanhai on 2011-11-04 http://blog.csdn.net/liquanhai/article/details/4955253 增加 ClosePort 中交出控制权,防止死锁问题 by liquanhai on 2011-11-06 http://blog.csdn.net/liquanhai/article/details/6941574 增加 ReceiveChar 中防止线程死锁 by viruscamp on 2013-12-04 https://github.com/viruscamp/CSerialPort 增加 IsOpen 判断是否打开 修正 InitPort 中 parity Odd Even 参数取值错误 修改 InitPort 中 portnr 取值范围,portnr>9 时特殊处理 取消对 MFC 的依赖,使用 HWND 替代 CWnd,使用 win32 thread 函数而不是 MFC 的 增加用户消息编号自定义,方法来自 CnComm by itas109 on 2014-01-10 http://blog.csdn.net/itas109/article/details/18358297 解决COM10以上端口无法显示的问题 扩展可选择端口,最大值MaxSerialPortNum可以自定义 添加QueryKey()和Hkey2ComboBox两个方法,用于自动查询当前有效的串口号。 by liquanhai on 2014-12-18 增加一些处理措施,主要是对减少CPU占用率 by itas109 on 2016-05-07 http://blog.csdn.net/itas109 修复每次打开串口发送一次,当串口无应答时,需要关闭再打开或者接收完数据才能发送的问题。 解决办法:在m_hEventArray中调整m_hWriteEvent的优先级高于读的优先级。CommThread(LPVOID pParam)函数中读写的位置也调换。 参考:http://zhidao.baidu.com/link?url=RSrbPcfTZRULFFd2ziHZPBwnoXv1iCSu_Nmycb_yEw1mklT8gkoNZAkWpl3UDhk8L35DtRPo5VV5kEGpOx-Gea 修复停止位在头文件中定义成1导致SetCommState报错的问题,应为1对应的停止位是1.5。UINT stopsbits = ONESTOPBIT switch(stopbits)和switch(parity)增加默认情况,增强程序健壮性 by itas109 on 2016-06-22 http://blog.csdn.net/itas109 增加ReceiveStr方法,用于接收字符串(接收缓冲区有多少字符就接收多少字符)。 解决ReceiveChar只能接收单个字符的问题。 by itas109 on 2016-06-29 http://blog.csdn.net/itas109 解决RestartMonitoring方法和StopMonitoring方法命令不准确引起的歧义,根据实际作用。 将RestartMonitoring更改为ResumeMonitoring,将StopMonitoring更改为SuspendMonitoring。 增加IsThreadSuspend方法,用于判断线程是否挂起。 改进ClosePort方法,增加线程挂起判断,解决由于线程挂起导致串口关闭死锁的问题。 增加IsReceiveString宏定义,用于接收时采用单字节接收还是多字节接收 by itas109 on 2016-08-02 http://blog.csdn.net/itas109 https://github.com/itas109 改进IsOpen方法,m_hComm增加INVALID_HANDLE_VALUE的情况,因为CreateFile

70,024

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧