📄 sendseq.c
字号:
/*シ〖ケンスモ〖ドのサンプルシ〖ケンスファイルをリダイレクトで掐蜗されると、ファイル粕み哈んで豺老し、鼎铜メモリのシ〖ケンスモ〖ド脱バッファに今き哈む。デ〖タを今き姜ると、シ〖ケンスモ〖ドスタ〖トを回绩する。 */#include <stdio.h>#include <string.h>#include <stdlib.h>/*鼎铜メモリ脱*/#include <mbuff.h>#include "MemMan.h"#define NAME_OF_MEMORY "DataSharedMemory"SM* pSM;#include "sm_access.h"#define COMMANDLEN 4096void usage();int main(int argc, char *argv[]){ char buf[COMMANDLEN]; int ret; DUNIT* unit; int count = 0; //鼎铜メモリのアロケ〖ション pSM = (SM*) mbuff_alloc(NAME_OF_MEMORY, \ sizeof(SM)); if(pSM == NULL) { perror("mbuff_alloc failed"); return -1; } // pSM->VarIF.ResInt = 1; for(;;) {// printf("command:"); /*筛洁掐蜗からのコマンド掐蜗を略つ*/ if( NULL == fgets(buf, COMMANDLEN, stdin)) { break; }// printf("%s", buf); if(strncmp("quit", buf, 4) == 0) { break; } if(buf[0] == ';') { printf("comment\n"); continue; } /*鼎铜メモリのシ〖ケンスモ〖ドデ〖タ脱バッファに今き哈む*/ unit = (DUNIT*)&(pSM->Data.SeqDat[count]); ret = send_sm(buf, unit); count++; if(count >= nSeqDat) break; } /*シ〖ケンスデ〖タの悸乖を回绩 */ pSM->Data.cSeq = 0;/*附哼悸乖面のデ〖タ*/ pSM->Data.nSeq = count;/*链デ〖タ眶*/// pSM->VarIF.ResInt = 0; pSM->VarIF.ResTimeMax = 0; pSM->VarIF.Mode = SEQUENTIAL;/*シ〖ケンスモ〖ドスタ〖トを回绩する*/// printf("Mode = %d\n", pSM->VarIF.Mode); printf("data count = %d\nstart\n", count); /*メモリ倡庶*/ mbuff_free(NAME_OF_MEMORY, (void*)pSM); return 0;}void usage(){ printf("sendseq < file\n");}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -