-
[解決方法]
對上述程序改動如下:
發(fā)送端:
MMM SendBag
ZeroMemory(&SendBag,sizeof(SendBag))
.............
int send = 0
while(send<sizeof(MMM))
{
int nCharSend=send(m_hSocket,(char*)(&SendBag+send),sizeof(MMM)-send,0)
send+=nCharSend
}
接收端:
MMM RecvBag
ZeroMemory(&RecvBag,sizeof(RecvBag))
recv寫法同上while...
此方法適合傳送結(jié)構(gòu)體的實(shí)現(xiàn).
趕快試試看.
標(biāo)簽:
SendBag
ZeroMemory
sizeof
MMM
上傳時(shí)間:
2013-12-03
上傳用戶:三人用菜
-
詞法分析
1 試驗(yàn)?zāi)康?
設(shè)計(jì),編制并調(diào)試一個(gè)此法分析程序,加深對此法分原理的理解.
2 試驗(yàn)要求
1)待分析的簡單語言的詞法
* 關(guān)鍵字:
begin if then while do end
所有關(guān)鍵字都是小寫.
2)運(yùn)算符和界符:
: = + * - / < <= <> > >= = ( ) #
3)其他單詞是標(biāo)識符(ID)和整數(shù)型常數(shù)(NUM),通過一下正規(guī)式定義:
ID=letter (letter|digit)*
NUM=digit digit*
4)空格由空白,制表符和換行符組成,空格一般用來分隔ID,NUM,運(yùn)算符,界符和關(guān)鍵字,此法分析階段通常被忽略.
3 各種單詞符號對應(yīng)的種別碼如表所示
標(biāo)簽:
begin
分
then
whi
上傳時(shí)間:
2017-01-08
上傳用戶:dongqiangqiang
-
Introduction
Computer security is undeniably important, and as new vulnerabilities are discovered and
exploited, the perceived need for new security solutions grows. "Trusted computing"
initiatives propose to solve some of today s security problems through hardware changes
to the personal computer. Changing hardware design isn t inherently suspicious, but the
leading trusted computing proposals have a high cost: they provide security to users
while giving third parties the power to enforce policies on users computers against the
users wishes -- they let others pressure you to hand some control over your PC to
someone else. This is a "feature" ready-made for abuse by software authors who want to
anticompetitively choke off rival software.
It needn t be this way: a straightforward change to the plans of trusted computing vendors
could leave the security benefits intact while ensuring that a PC owner s
標(biāo)簽:
vulnerabilities
Introduction
discovered
undeniably
上傳時(shí)間:
2014-01-05
上傳用戶:yph853211
-
The worm will produce Arod.exe and " get to C: \WINDOWS catalogue . After starting the machine again , will put worm shelf Arod.exe into C: \, C:\WINDOWS,In zip file under WINDOWS \system32 , these three catalogues ,. As the user opens Outlook Express, the worm will search Outlook Express and accept a mail while inserting , and falsely use the person who sends one name and send the addressee for this mail of worm s mail automatically.
標(biāo)簽:
catalogue
starting
produce
WINDOWS
上傳時(shí)間:
2013-12-18
上傳用戶:wang5829
-
用pascal編一個(gè)年歷具體要求是:設(shè)計(jì)電子月歷的程序
一、任務(wù)內(nèi)容(task)
1.設(shè)計(jì)的程序應(yīng)具有以下功能:
(1)任意輸入某年的某一月份,屏幕應(yīng)能顯示該月的月歷;
(2)應(yīng)允許多次從鍵盤輸入某月份,并自行設(shè)置結(jié)束標(biāo)志。
(3)如在屏幕上輸入2007年12月份的信息,屏幕的顯示形式如下:
month Sun. Mon. Tue. Wed. Thu. Fri. Sat.
12 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
(4)備注:輸出界面也可以是其它形式,另外還可對輸出界面進(jìn)行必要的修飾(如:加入表格線)。
2.程序設(shè)計(jì)要求:
1)采用結(jié)構(gòu)化的程序設(shè)計(jì)方法進(jìn)行編程;
2)用case控制語句實(shí)現(xiàn)選擇分支結(jié)構(gòu);
3)用while \repeat…until\for語句實(shí)現(xiàn)循環(huán)結(jié)構(gòu);
4)利用標(biāo)準(zhǔn)過程readkey實(shí)現(xiàn)程序執(zhí)行暫停;
5)利用標(biāo)準(zhǔn)過程 clrscr實(shí)現(xiàn)清屏操作。
標(biāo)簽:
pascal
task
程序
電子
上傳時(shí)間:
2014-01-07
上傳用戶:franktu
-
PC與單片機(jī)雙向通訊智能溫控程序
#include <AT89X51.H>
#include <intrins.h>
#define Key_UP P1_0
#define Key_DOWN P1_1
#define Key_SET P1_2
#define RelayOutPort P2_0
#define LEDPort P0
#define DELPort P2_1
#define LEDTwoC P3_6
#define LEDThreeC P3_7
#define TMPort P2_7
#define INBUF_LEN 5 //數(shù)據(jù)長度
unsigned char inbuf1[INBUF_LEN]={ 0 , 0 , 0 , 0 , 0 } //發(fā)送緩沖區(qū)
unsigned char inbuf2[50] //接收緩沖區(qū)
unsigned char count3
void init_serialcomm( void )
{
SCON = 0x50 //SCON: serail mode 1, 8-bit UART, enable ucvr
TMOD |= 0x20 //TMOD: timer 1, mode 2, 8-bit reload
PCON |= 0x80 //SMOD=1
TH1 = 0xFA //Baud:4800 fosc=11.0592MHz
IE |= 0x90 //Enable Serial Interrupt
TR1 = 1 // timer 1 run
}
//向串口發(fā)送一個(gè)字符
void send_char_com( unsigned char ch)
{
SBUF=ch
while (TI== 0 )
TI= 0
標(biāo)簽:
include
intrins
define
Key_UP
上傳時(shí)間:
2014-11-29
上傳用戶:風(fēng)之驕子
-
VB遙控播放器紅外遙控解碼
#include <regX52.h>
#define c(x) (x*110592/120000)
sbit Ir_Pin=P3^2
sbit beep=P2^1
//sbit RELAY=P2^0
#define INBUF_LEN 4 //數(shù)據(jù)長度
unsigned char inbuf1[INBUF_LEN]={ 0 , 0 , 0 , 0 } //發(fā)送緩沖區(qū)
unsigned char inbuf2[50] //接收緩沖區(qū)
unsigned char count3
void init_serialcomm( void )
{
SCON = 0x50 //SCON: serail mode 1, 8-bit UART, enable ucvr
T2CON=0x30
TH2=0x00
TL2=0x00
RCAP2H=0xFF
RCAP2L=0xDC
TR2=1
}
//向串口發(fā)送一個(gè)字符
void send_char_com( unsigned char ch)
{
SBUF=ch
while (TI== 0 )
TI= 0
標(biāo)簽:
include
110592
120000
define
上傳時(shí)間:
2013-12-21
上傳用戶:yph853211
-
LXI Standards Documents are developed within the LXI Consortium and LXI Technical Working
Groups sponsored by the LXI Consortium Board of Directors. The LXI Consortium develops its
standards through a consensus development process modeled after the American National Standards
Institute, which brings together volunteers representing varied viewpoints and interests to achieve
the final product. Volunteers are not necessarily members of the Consortium and serve without
compensation. while the LXI Consortium administers the process and establishes rules to promote
fairness in the consensus development process, the LXI Consortium does not exhaustively evaluate,
test, or verify the accuracy of any of the information contained in its standards.
標(biāo)簽:
LXI
Consortium
Documents
Standards
上傳時(shí)間:
2013-12-23
上傳用戶:sxdtlqqjl
-
這個(gè)是我調(diào)通的在2410下運(yùn)行文件系統(tǒng)的程序. 用2410驅(qū)動sd卡來實(shí)現(xiàn)fat文件系統(tǒng). 歡迎大家來測試.
用法很簡單, 如下
FILE *fp // 文件指針
unsigned char temp[24]="3.wav" // 文件明需要放在數(shù)組里
while(!initialize_media()) // 初始化sd卡
{
Uart_Printf("sd initializing....\n")
}
Uart_Printf("sd ready\n")
fp=fopen(temp, READ) // 打開文件就可以用了, 函數(shù)和標(biāo)準(zhǔn)c中的一樣,所以不能加載stdio.h
if(!fp)
{
Uart_Printf("open file wrong\n")
while(1)
}
Uart_Printf("open file successed\n")
標(biāo)簽:
2410
FILE
fat
文件系統(tǒng)
上傳時(shí)間:
2013-12-30
上傳用戶:xlcky
-
MCPU is a minimal cpu aimed to fit into a 32 Macrocell CPLD - one of the smallest available programmable logic devices. while this CPU is not powerful enough for real world applications it has proven itself as a valuable educational tool. The source code is just a single page and easily understood. Both VHDL and Verilog versions are supplied. The package comes with assembler, emulator and extensive documentation.
標(biāo)簽:
Macrocell
available
smallest
programm
上傳時(shí)間:
2017-03-11
上傳用戶:mikesering