虫虫首页|资源下载|资源专辑|精品软件
登录|注册

sizeof

  • 周立功D12开发板中带的WINDOWS XP驱动程序

    周立功D12开发板中带的WINDOWS XP驱动程序,在编译后会出现USB设备不能正常工作. 以下是修改的代码,修改后可以正常工作. 在d12.c和Ioctl.c中, 将+256去掉,这个会引去枚举设备时,设备描述符的长度不对,修改后: siz = sizeof(USB_CONFIGURATION_DESCRIPTOR) 在d12.c中的D12_SelectInterface函数中, 设备查询完接口后有一段代码,也会引起驱动返回不对,需要屏蔽下面的代码 // Retrieve the selected Configuration and Interface 修改上面两处后,USB可以正常使用了.

    标签: WINDOWS D12 开发板 驱动程序

    上传时间: 2014-01-06

    上传用户:it男一枚

  • //打开 USB 口读写, 由驱动程序的 Pipe 名确定 HANDLE hPipe = OpenMyDevPipe("MyPipe1") //驱动程序里面的 Pipe 名, 对应访问某个端点

    //打开 USB 口读写, 由驱动程序的 Pipe 名确定 HANDLE hPipe = OpenMyDevPipe("MyPipe1") //驱动程序里面的 Pipe 名, 对应访问某个端点的 I/O, 这里我乱写的, 需要与驱动一致 if(hPipe != INVALID_HANDLE_VALUE) //打开 Pipe 成功 { ReadFile(hPipe, Buffer, BufSize, &nBytesRead, NULL) //从 hPipe 里读取数据到 Buffer 里 //WriteFile(hPipe, Buffer, BytesToWrite, &nBytesWritten, NULL) //把 Buffer 里面的 BytesToWrite 字节写入 hPipe CloseHandle(hPipe) } //使用 DeviceIoControl 访问 USB 设备 HANDLE hDevice = OpenMyDevice() if(hDevice != INVALID_HANDLE_VALUE) //打开设备成功 { //这些 DeviceIoControl 功能都是由设备定义的, 具体看设备和驱动的资料 if(DeviceIoControl(hDevice, IOCTL_READ_xxxx, &IOBlock, sizeof(IOBLOCK), &c, 1, &nBytes, NULL)) { //成功 } CloseHandle(hDevice) }

    标签: Pipe OpenMyDevPipe MyPipe1 HANDLE

    上传时间: 2014-11-25

    上传用户:stampede

  • 学会对文件的记录锁定

    学会对文件的记录锁定,及解锁。#include <stdio.h> #include <unistd.h> #include <fcntl.h> int main() { int fd int i struct { char name[20] uint ID int age } myrec fd =open("name", O_RDWR|O_CREAT, 0755) if (fd == -1) return -1 printf("Input your name:") scanf("%s", myrec.name) printf("Inpute your ID :") scanf("%d", &myrec.ID) printf("Input your age :") scanf("%d", &myrec.age) lseek(fd, 0,SEEK_END) lockf(fd, 1, 0) write(fd, (void *)&myrec, sizeof(myrec)) lockf(fd, 0 ,0) return 0 } 执行命令cc lock.c –o lock.out Chmod +x lock.out ./lock.out

    标签: 记录

    上传时间: 2016-01-04

    上传用户:亚亚娟娟123

  • Programming interviews exposed 程序员面试宝典 本书取材于各大IT公司历年面试真题(包括笔试题、口试题、电话面试、英语面试

    Programming interviews exposed 程序员面试宝典 本书取材于各大IT公司历年面试真题(包括笔试题、口试题、电话面试、英语面试,以及逻辑测试和智商测试)。通过精确详细的分类,把在应聘程序员(含网络、测试等)过程中所遇见的常见考点分为21章。不仅对传统的C系语言考点做了详尽的解说,包括面向对象问题、sizeof问题、const问题、数据结构问题等。还根据外企出题最新特点,针对设计模式问题、C#问题、网络问题、数据库问题、NET问题等,做了深入的说明。 程序员面试宝典 英文版 Programming interviews exposed

    标签: Programming interviews exposed 程序员面试

    上传时间: 2014-01-05

    上传用户:gonuiln

  • 主要源码: void CFDlg::OnChangeEdit1() { UpdateData() m_strExt.MakeUpper() m_list.ResetConte

    主要源码: void CFDlg::OnChangeEdit1() { UpdateData() m_strExt.MakeUpper() m_list.ResetContent() if(m_strExt.GetLength()==0) return CStdioFile sf if(sf.Open("FileExt.txt",Cfile::modeRead)) { CString strTemp,strOut while(sf.ReadString(strTemp)) { if(strTemp.Left(m_strExt.GetLength()) ==m_strExt) { m_list.AddString(strTemp) } } } sf.Close() m_list.SetCurSel(0) this->OnSelchangeList2() } void CFDlg::OnSelchangeList2() { CString strTemp,strExt m_list.GetText(m_list.GetCurSel(),strTemp) strExt=strTemp.Left(strTemp.FindOneOf(" ")) //MessageBox(strExt) CString strFileName ="eee."+strExt //MessageBox(strFileName) SHFILEINFO shfi memset(&shfi,0,sizeof(shfi)) //或者ZeroMemory(&shfi,sizeof(shfi)) ::SHGetFileInfo(strFileName, FILE_ATTRIBUTE_NORMAL, &shfi, sizeof(shfi), SHGFI_ICON|SHGFI_USEFILEATTRIBUTES) m_icon.SetIcon(shfi.hIcon) }

    标签: OnChangeEdit1 UpdateData ResetConte MakeUpper

    上传时间: 2013-12-20

    上传用户:zl5712176

  • Wrox.Programming.Interviews.Exposed.2nd.Edition 这个是全英文的第二版,chm版本, 本书取材于各大IT公司历年面试真题(包括笔试题、口试题、电话面试、

    Wrox.Programming.Interviews.Exposed.2nd.Edition 这个是全英文的第二版,chm版本, 本书取材于各大IT公司历年面试真题(包括笔试题、口试题、电话面试、英语面试,以及逻辑测试和智商测试)。通过精确详细的分类,把在应聘程序员(含网络、测试等)过程中所遇见的常见考点分为21章。不仅对传统的C系语言考点做了详尽的解说,包括面向对象问题、sizeof问题、const问题、数据结构问题等。还根据外企出题最新特点,针对设计模式问题、C#问题、网络问题、数据库问题、NET问题等,做了深入的说明。

    标签: Programming Interviews Exposed Edition

    上传时间: 2016-12-08

    上传用户:13188549192

  • 依次输入单个字符到该数组中

    依次输入单个字符到该数组中,直到输入回车完成该字符数组的输入。反向输出该数组中的字符串内容。 // 输入:This is Test! 输出结果为:!tseT si sihT // 并利用sizeof运算符,求出数组占用的内存字节数

    标签: 输入 字符 数组

    上传时间: 2016-12-29

    上传用户:lijianyu172

  • 自然对界

    自然对界,Win32平台下的微软C编译器(cl.exe for 80x86)在默认情况下采用如下的对齐规则:任何基本数据类型T的对齐模数就是T的大小,即sizeof(T)。比如对于double类型(8字节),

    标签:

    上传时间: 2013-12-13

    上传用户:vodssv

  • client socket include <sys/types.h> include <sys/socket.h> include <stdio.h> i

    client socket include <sys/types.h> include <sys/socket.h> include <stdio.h> include <netinet/in.h> include <arpa/inet.h> include <unistd.h> int main() { int sockfd int len struct sockaddr_in address int result char ch = A sockfd = socket(AF_INET, SOCK_STREAM, 0) address.sin_family = AF_INET address.sin_addr.s_addr = inet_addr("127.0.0.1") address.sin_port = 9734 len = sizeof(address) result = connect(sockfd, (struct sockaddr *)&address, len) if(result == -1) { perror("oops: client") exit(1) } write(sockfd, &ch, 1) read(sockfd, &ch, 1) printf("char from server = c\n", ch) close(sockfd) exit(0) }

    标签: include socket sys gt

    上传时间: 2017-07-29

    上传用户:wab1981

  • 两个链表的交集

    两个链表的交集 #include<stdio.h> #include<stdlib.h> typedef struct Node{   int data;   struct  Node *next; }Node; void initpointer(struct Node *p){   p=NULL; } int  printlist(struct Node* head){   int flag=1;   head=head->next;   /*   因为标记1的地方你用了头结点,所以第一个数据域无效,应该从下一个头元结点开始   */   if(head==NULL)     printf("NULL\n");   else   {     while(head!=NULL)     {       if(flag==1)       {       printf("%d",head->data);       flag=0;       }       else       {         printf(" %d",head->data);       }       head=head->next;     }     printf("\n");   }   return 0; } struct Node *creatlist(struct Node *head) {      int n;    struct  Node *p1=(struct Node *)malloc(sizeof(struct Node));   p1->next=NULL; while(scanf("%d",&n),n!=-1) {   struct Node *pnode=(struct Node *)malloc(sizeof(struct Node));   pnode->next=NULL;      pnode->data=n;   if(head==NULL)     head=pnode;   p1->next=pnode;   p1=pnode; } return head; } struct Node *Intersect(struct Node *head1, struct Node *head2) { struct Node *p1=head1,*p2=head2;/*我这里没有用头指针和头结点,这里是首元结点head1里面就是第一个数据,一定要理解什么事头指针, 头结点,和首元结点 具体你一定要看这个博客:http://blog.sina.com.cn/s/blog_71e7e6fb0101lipz.html*/ struct Node *head,*p,*q; head = (struct Node *)malloc(sizeof(struct Node)); head->next = NULL; p = head; while( (p1!=NULL)&&(p2!=NULL) ) { if (p1->data == p2->data) { q = (struct Node *)malloc(sizeof(struct Node)); q->data = p1->data; q->next = NULL; p->next = q;//我可以认为你这里用了头结点,也就是说第一个数据域无效     **标记1** p = q; p1 = p1->next; p2 = p2->next; } else if (p1->data < p2->data) { p1 = p1->next; } else { p2 = p2->next; } } return head; } int main() {   struct Node *head=NULL,*headt=NULL,*t;   //initpointer(head);//这里的函数相当于head=NULL;  // initpointer(headt);//上面已经写了headt=NULL那么这里可以不用调用这个函数   head=creatlist(head);   headt=creatlist(headt);   t=Intersect(head,headt);   printlist(t); }

    标签: c语言编程

    上传时间: 2015-04-27

    上传用户:coco2017co