ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

套接字编程实验

2021-12-16 10:37:06  阅读:108  来源: 互联网

标签:file int 编程 char 实验 str printf 接字 include


为取用方便,代码包含:

(1)路径斜杠替换 => 方便文件读取

(2)图片像素数据用文件保存

(3)遍历文件夹下所有文件名

(4)分块文件数据的组合

(5)套接字面向连接的 TCP 数据传输

(6)多线程

(7)字符串数据的分割

(8)字符串与整数的相互转换

(9)字符串相关操作 => string.h

(10)图像打印与保存 => EGE图形库

(11)文件大小获取、文件读取

(12)字符串格式规范 => sprintf


实验答辩 PPT 

 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 


 

附:

(1)服务器代码:

  1 #include <stdio.h>
  2 #include <string.h>
  3 #include <pthread.h>
  4 // Winsock是一个基于Socket模型的API
  5 #include <winsock2.h>
  6 #include <windows.h>
  7 #include "graphics.h"
  8 
  9 // 要包含头文件 Winsock2.h,就需要调用库 ws2_32.lib
 10 #pragma comment( lib, "ws2_32.lib" )
 11 
 12 
 13 
 14 /* Winsock启动测试,检查系统协议栈安装情况 */
 15 void TestWinsockStartup();
 16 
 17 
 18 // 分块大小固定为100KB 
 19 
 20 
 21 /* 定义全局变量 */
 22 // 待获取的文件名后缀 (除序号外的信息) 
 23 char getFileName[] = "_28#1440_665.myt";
 24 // 用来存储图像数据 
 25 int width=1440, height=665;   // 也可通过填写的待获取文件名后缀获取图片宽高信息 
 26 // 待维护的要获取文件数组 (数组大小也可通过上面方法获得) 
 27 const int block_num = 28 + 1;
 28 // block该由哪个序号的 peer上传 (上传名额被谁抢到了) 
 29 int blocks[block_num];
 30 // 每个分块的数据 
 31 char block_data[block_num][100*1024];  // 每个分块为 100KB 
 32 
 33 
 34 
 35 /* 要经常检查分块是否已全部收到 */
 36 bool isReceiveAll() {
 37     bool flag = true;
 38     for(int i=0; i<block_num; i++) {
 39         if( blocks[i] == -1 ) {
 40             flag = false;
 41         }
 42     }
 43     return flag;
 44 }
 45 
 46 
 47 
 48 /* 保存连接的 client信息 */
 49 struct SocketInfo {
 50     SOCKADDR_IN cli;   // 其实只有 accept()时才用到 cli,连接后几乎可以不用 
 51     SOCKET sAccept;
 52 } sAccepts[20];       // 最多 20个client连接
 53 int peer_id = 0;      // peer序号计数 
 54 
 55 
 56 // 每个 client拥有的文件
 57 // 下标就是 client的序号 
 58 struct ClientFiles {
 59     int len;                   // 拥有总文件数 
 60     char file_name[50][50];    // 文件名 
 61     int idx[50];               // 文件序号 
 62     bool getFile[50];          // 文件是否要索要 
 63 } clientFiles[20];   // 最多 20个client连接 
 64 
 65 
 66 
 67 // 获取文件名列表 
 68 void *AskFilesName( void *arg ) {
 69     int id = *(int *)(arg);
 70 //    printf("id: %d\n", id);
 71     
 72     SOCKET *sAccept = &sAccepts[id].sAccept;
 73     char command[] = "AskFilesName";
 74     
 75     // 1. 索要所有文件名 
 76     int iSend = send( *sAccept, command, sizeof(command), 0 );
 77     if( iSend == SOCKET_ERROR ) {
 78         printf("send() Failed: %d\n", WSAGetLastError());
 79     } else if( iSend == 0) {
 80         printf("发送失败!\n");
 81     } else {
 82         printf(">>> peer%d所有文件名给我看看!\n", id);
 83     }
 84     
 85     // 2. 接收所有文件名 
 86     char str[1024*3];
 87     int iLen = recv( *sAccept, str, sizeof(str), 0 ); 
 88     if( iLen == SOCKET_ERROR ) {
 89         printf("recv() Failed: %d\n", WSAGetLastError());
 90     } else if( iLen == 0 ) {
 91         printf("接收失败!\n");
 92     } else {
 93         printf("%s\n", str);
 94     }
 95     
 96     // 3. 将收到的字符串分割成文件名存放在结构体中 
 97     char num_str[10];
 98     int i, j;
 99     for(i=0; str[i]!='&'; i++) {
100         num_str[i] = str[i];
101     }
102     num_str[i++] = '\0';
103     clientFiles[peer_id].len = atoi(num_str);
104     // 分割 
105     char file_name[50];
106     int index=0, cnt=0;
107     for( ; str[i]!='\0'; i++) {
108         if( str[i]=='&' ) {
109             file_name[index] = '\0';
110 //            printf("%s\n", file_name);
111             // 得到序号
112             char ttmp[10];
113             for(j=0; file_name[j]!='_'; j++) {
114                 ttmp[j] = file_name[j];
115             } 
116             ttmp[j] = '\0';
117             // 添加上序号 
118             clientFiles[peer_id].idx[cnt] = atoi(ttmp);
119             // 添加上文件名
120             strcpy( clientFiles[peer_id].file_name[cnt], file_name );
121             index = 0;
122             cnt++;
123         } else {
124             file_name[index++] = str[i];
125         }
126     }
127     // 文件总数目 
128     clientFiles[peer_id].len = cnt;
129     // 索要文件初始化
130     for(i=0; i<50; i++) {
131         clientFiles[peer_id].getFile[i] = false;
132     } 
133     
134     // 4. 打印看看有没有错误
135 //    printf("peer%d:\nlen: %d\n", peer_id, clientFiles[peer_id].len);
136 //    for(i=0; i<clientFiles[peer_id].len; i++) {
137 //        printf("file index: %d\n", clientFiles[peer_id].idx[i]);
138 //        printf("file name: %s\n", clientFiles[peer_id].file_name[i]);
139 //    }
140     
141     // 5. 为该 peer抢分块上传名额 
142     char send_str[1024] = "";
143     int count = 0;  // 要传输的文件计数 
144     for(i=0; i<clientFiles[peer_id].len; i++) {
145         // peer拥有的第 i个文件的分块序号 
146         int idx = clientFiles[peer_id].idx[i];
147         // 这个分块还没被抢 
148         if( blocks[idx] == -1 ) {
149             blocks[idx] = peer_id;    // 这个分块被 peer_id抢了 
150             clientFiles[peer_id].getFile[idx] = true;   // 待上传文件 
151             count++;   // 该 peer将要传的文件数量 
152             // 待索要的文件名 加入待传输字符串中 
153             char tmp[10];
154             itoa(idx, tmp, 10);    // 十进制 
155             strcat(send_str, tmp);
156             strcat(send_str, getFileName);  // 文件后缀 (除序号外的信息)
157             strcat(send_str, "&");
158         }
159         strcat(send_str, "\0");
160     }
161 //    for(i=0; i<block_num; i++) printf("%d: %d\n", i, blocks[i]);
162     
163     // 6. 接收文件
164     // 发出所有需要的文件的文件名 
165     iSend = send( *sAccept, send_str, sizeof(send_str), 0 );
166     if( iSend == SOCKET_ERROR ) {
167         printf("send() Failed: %d\n", WSAGetLastError());
168     } else if( iSend == 0 ) {
169         printf("发送失败!\n");
170     } else {
171         printf(">>> 文件传输列表:%s\n", send_str);
172     }
173     short *img_mx = (short *)malloc(width*height*3*sizeof(short));
174     // 接收所有 getFile = true的文件 
175     for(i=0; i<clientFiles[peer_id].len; i++) {
176         int index = clientFiles[peer_id].idx[i];
177         // 索要的文件 
178         if( clientFiles[peer_id].getFile[index] ) {
179             iLen = recv( *sAccept, block_data[index], sizeof(block_data[index]), 0 ); 
180             if( iLen == SOCKET_ERROR ) {
181                 printf("recv() Failed: %d\n", WSAGetLastError());
182             } else if( iLen == 0 ) {
183                 printf("第%d个分块丢失了\n", index);
184             } else {
185                 printf("第%d个分块已接收\n", index);
186             }
187         }
188     }
189     
190     if( isReceiveAll() ) {
191         printf(">>> 所有分块均已收到!\n");
192         
193         // 7. 将所有分块数据转化成图像数据
194         // 分块拼接起来
195         char *total = (char *)malloc(width*height*3*sizeof(char)); 
196         int tcnt = 0;
197         for(i=0; i<block_num; i++) {
198             for(j=0; j<100*1024; j++) {
199                 if( i*100*1024+j >= width*height*3 ) {
200                     break;
201                 }
202                 *(img_mx+tcnt) = (unsigned char)block_data[i][j];
203                 tcnt++;
204 //                printf("%hd ", *(img_mx+tcnt));
205             }
206 //            printf("j:%d\n", j);
207         }
208 //        printf("tcnt: %d", tcnt);
209         
210         // 8. 打印图像矩阵 
211         short red, green, blue;
212         for(i=0; i<width; i++) {
213             for(j=0; j<height; j++) {
214                 red   = *(img_mx+3*(height*i+j)+0);
215                 green = *(img_mx+3*(height*i+j)+1);
216                 blue  = *(img_mx+3*(height*i+j)+2);
217                 putpixel(i, j, EGERGB(red, green, blue));
218             }
219         }
220         // 保存图像
221         PIMAGE pimg = newimage();                    
222         getimage(pimg, 0, 0, getwidth(), getheight()); 
223         saveimage(pimg, "receive.jpg");
224         
225         // 在此关闭连接 
226         closesocket( *sAccept );
227         free(img_mx);
228         delimage(pimg);
229         return NULL;
230     }
231     
232     // 在此关闭连接 
233     closesocket( *sAccept );
234     return NULL;
235 }
236 
237 
238 
239 int main() {
240     initgraph(width, height, 0);
241     setcaption("ByHansel");
242     
243     // Winsock启动测试
244     TestWinsockStartup();
245     
246     // 分块初始化 
247     for(int i=0; i<block_num; i++) blocks[i]=-1;   // -1代表还没人抢到 
248     
249     SOCKET sListen;
250     struct sockaddr_in ser;
251     
252     // 1. 创建服务器端通信套接字 
253     sListen = socket( AF_INET, SOCK_STREAM, 0 );
254     if( sListen == INVALID_SOCKET ) {
255         printf("socket() Failed: %d\n", WSAGetLastError());
256         return -1;
257     }
258     
259     // 2. 将创建的套接字与服务器地址进行绑定 
260     ser.sin_family = AF_INET;
261     ser.sin_port = htons( 44965 );  // 端口号
262     ser.sin_addr.s_addr = htonl( INADDR_ANY ); 
263     if( bind(sListen, (LPSOCKADDR)&ser, sizeof(ser)) == SOCKET_ERROR ){
264         printf("bind() Failed: %d\n", WSAGetLastError());
265         return -1;
266     }
267     
268     // 3. 进入监听状态 
269     if( listen(sListen, 5) == SOCKET_ERROR ) {
270         printf("lisiten() Failed: %d\n", WSAGetLastError());
271         return -1;
272     }
273     
274     
275     // 4. 获取所有文件列表 
276     peer_id = 0;
277     printf(">>> 等待peer接入!\n");
278     while(1) {
279         // 4.1. 接收到客户连接请求 
280         SOCKET *sAccept = &sAccepts[peer_id].sAccept;
281         SOCKADDR_IN *cli = &sAccepts[peer_id].cli;
282         int iLen = sizeof(*cli);
283         *sAccept = accept( sListen, (struct sockaddr *)cli, &iLen );
284         if( *sAccept == INVALID_SOCKET ) {
285             printf("accept() Failed: %d\n", WSAGetLastError());
286             return -1;
287         }
288         // 输出客户 IP地址和端口号
289         printf("Accepted client IP:[%s], port:[%d]\n", inet_ntoa(cli->sin_addr), ntohs(cli->sin_port));
290         
291         // 4.2. 创建新进程处理连接请求
292         pthread_t tid;
293         // 接收分块 0的文件名和数据 
294         int id = peer_id;    // 不能直接传 peer_id的地址 
295         pthread_create(&tid, NULL, AskFilesName, &id);
296         // 主线程与子线程分离,子线程结束后,资源自动回收
297         pthread_detach(tid);
298         peer_id++;
299     }
300     
301     getch();
302     closegraph();
303     closesocket(sListen);
304     WSACleanup();
305     return 0;
306 }
307 
308 
309 
310 /* Winsock启动测试,检查系统协议栈安装情况 */
311 void TestWinsockStartup() {
312     WORD wVersionRequested;
313     WSADATA wsaData;
314     wVersionRequested = MAKEWORD(2, 2);
315     
316     if( WSAStartup(wVersionRequested, &wsaData) != 0 ) {
317         printf("Winsock初始化错误!\n");
318         return ;
319     }
320     if( wsaData.wVersion != wVersionRequested ) {
321         printf("Winsock版本不匹配!\n");
322         WSACleanup();
323         return ;
324     }
325 //    printf("WinsockDLL正确加载!\n");
326 }

 

(2)客户端代码:

#include <stdio.h>
#include <string.h>
#include <io.h>
// Winsock是一个基于Socket模型的API
#include <winsock2.h>

// 要包含头文件 Winsock2.h,就需要调用库 ws2_32.lib
#pragma comment( lib, "ws2_32.lib" )



/* Winsock启动测试,检查系统协议栈安装情况 */
void TestWinsockStartup();



char IPaddr[] = "127.0.0.1";
int main() {
    // Winsock启动测试
    TestWinsockStartup();
    
    SOCKET sClient;
    // 从服务器端接收的数据长度
    int iLen;
    // 接收数据的缓冲区
    char buf[50];
    //接收缓冲区初始化
    memset( buf, 0, sizeof(buf) );
    // 服务器端地址
    struct sockaddr_in ser;
    
    
    // 1. 填写要连接的服务器地址信息
    ser.sin_family = AF_INET;
    ser.sin_port = htons( 44965 );
    ser.sin_addr.s_addr = inet_addr( IPaddr );
    
    // 2. 建立客户端流式套接字
    sClient = socket( AF_INET,SOCK_STREAM, 0 );
    if( sClient == INVALID_SOCKET ) {
        printf("socket() Failed: %d\n", WSAGetLastError());
        return -1;
    }

    // 3. 请求与服务器端建立 TCP连接
    if( connect(sClient, (struct sockaddr *)&ser, sizeof(ser)) == INVALID_SOCKET ) {
        printf("connect() Failed: %d\n", WSAGetLastError());
        return -1;
    } else {
        // 从服务器端接收命令
        iLen = recv( sClient, buf, sizeof(buf), 0 );
        if( iLen == SOCKET_ERROR ) {
            printf("recv() Failed: %d\n", WSAGetLastError());
            return -1;
        } else if( iLen == 0) {
            printf("接收失败!\n");
        } else {
            // 4. 交出所有文件名 
            if( strcmp(buf, "AskFilesName") == 0 ) {
                /*  拥有的所有文件名发过去 */
                char str[1024] = "";      // 要发送的字符串 
                // 遍历文件夹 
                _finddata_t fileDir;
                long lfDir;
                int len = 0;              // 文件总数量 
                // _findfirst():如果查找成功的话,将返回一个 long型的唯一的查找用的句柄
                if( ( lfDir=_findfirst("upload//*.myt", &fileDir) ) == -1l ) {
                    printf("No file is found\n");
                } else {
                    // _findnext():若成功返回0,否则返回-1
                    do {
                        len++;
                        // &为每个文件名的分隔符 
                        strcat(str, "&");
                        strcat(str, fileDir.name);
                    } while( !_findnext( lfDir, &fileDir ) );
                }
                // 末尾加上 
                strcat(str, "&\0");
                _findclose(lfDir);
                
                // 将文件总数量放在最前面 
                char tmp[1024];
                itoa(len, tmp, 10);    // 十进制 
                strcat(tmp, str);
                // 将包含所有文件名的字符串传过去
                int iSend = send( sClient, tmp, sizeof(str), 0 );
                if( iSend == SOCKET_ERROR ) {
                    printf("send() Failed: %d\n", WSAGetLastError());
                } else if( iSend == 0 ) {
                    printf("发送失败!\n");
                } else {
                    printf(">>> 我全上报了!\n");
                }
            }
        }
        // 5. 接收文件传输列表
        char recv_str[1024];
        iLen = recv( sClient, recv_str, sizeof(recv_str), 0 );
        if( iLen == SOCKET_ERROR ) {
            printf("recv() Failed: %d\n", WSAGetLastError());
            return -1;
        } else if( iLen == 0 ) {
            printf("接收失败!\n");
        } else {
            printf("待传输文件:%s\n", recv_str);
        }
        
        // 6. 传输给定文件 
        // 分割文件名 
        char file_name[50][50];
        int count=0, index=0;
        for(int i=0; recv_str[i]!='\0'; i++) {
            if( recv_str[i] == '&' ) {
                file_name[count][index] = '\0';
//                printf("%s\n", file_name[count]);
                count++;
                index = 0;
            } else {
                file_name[count][index++] = recv_str[i];
            }
        }
        // 传输文件 
        for(int i=0; i<count; i++) {
            // 读取文件
            char read_data[100*1024];   // 一次最多读 100KB数据
            char PATH[50];
            sprintf(PATH, "%s%s", "upload/", file_name[i]);
            FILE *fp;
            fp = fopen(PATH, "rb");
            printf("%s\n", PATH);
            // 读取文件 
            fseek( fp, 0, SEEK_END );
            int file_size = ftell( fp );
            fseek( fp, 0, SEEK_SET );
            fread( read_data, sizeof(char), file_size, fp );
            fclose(fp);
            // 发送文件流 
            int iSend = send( sClient, read_data, sizeof(read_data), 0 );
            if( iSend == SOCKET_ERROR ) {
                printf("send() Failed: %d\n", WSAGetLastError());
            } else if( iSend == 0 ) {
                printf("发送失败!\n");
            } else {
                printf("%s已成功发送!\n", file_name[count]);
            }
            Sleep(1);
        }
    }
    
    closesocket(sClient);
    WSACleanup();
    system("pause");
    return 0;
}



/* Winsock启动测试,检查系统协议栈安装情况 */
void TestWinsockStartup() {
    WORD wVersionRequested;
    WSADATA wsaData;
    wVersionRequested = MAKEWORD(2, 2);
    
    if( WSAStartup(wVersionRequested, &wsaData) != 0 ) {
        printf("Winsock初始化错误!\n");
        return ;
    }
    if( wsaData.wVersion != wVersionRequested ) {
        printf("Winsock版本不匹配!\n");
        WSACleanup();
        return ;
    }
//    printf("WinsockDLL正确加载!\n");
}

 

(3)图片分块代码:

#include <stdio.h>
#include <string.h>
#include <math.h>
#include "graphics.h"

char PATH[] = "building.jpg";
int size = 100;  // KB

int main() {
    color_t color;
    int i, j; 
    short width, height, red, green, blue;
    
    for(i=0; i<strlen(PATH); i++) {
        if(PATH[i] == '\\') {
            PATH[i] = '/';
        }
    }
    
    PIMAGE pimg = newimage();
    getimage(pimg, PATH);
    width  = getwidth(pimg);
    height = getheight(pimg);
    short *img_mx = (short *)malloc(width*height*3*sizeof(short));
    
    for(i=0; i<width; i++) {
        for(j=0; j<height; j++) {
            color = getpixel(i, j, pimg);
            red   = EGEGET_R(color);
            green = EGEGET_G(color);
            blue  = EGEGET_B(color);
            *(img_mx+3*(height*i+j)+0) = red;
            *(img_mx+3*(height*i+j)+1) = green;
            *(img_mx+3*(height*i+j)+2) = blue;
        }
    }
    
    
    
    
    // 待保存数据 
    char *save = (char *)malloc(width*height*3*sizeof(char));
    for(i=0; i<width*height*3; i++) {
        // 用 char保存图像灰度值数据 
        *(save+i) = (char)*(img_mx+i);
    }
    
    // 文件分块数量 
    int num_block = ceil(width*height*3.0/size/1024.0);
    char file_name[50];
    for(i=0; i<num_block; i++) {
        // 文件取名 
        sprintf(file_name, "%d_%d#%d_%d", i, num_block-1, width, height);
        strcat(file_name, ".myt");
        printf("%s\n", file_name);
        FILE *fp;
        fp = fopen(file_name, "wb");
        
        for(j=0; j<size*1024; j++) {
            if( i*size*1024+j < width*height*3 ) {
                fprintf(fp, "%c", *(save+i*size*1024+j));
            } else {
                break;
            } 
        }
        
        fclose(fp);
    }
    
    
    free(img_mx);
    free(save);
    delimage(pimg);
    return 0;
} 

 

(4)图片组合代码:

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <io.h>
#include "graphics.h"

int width=1440, height=665;
int size = 100;  // KB


void SortByIndex(char files[][50], int n) {
    int i, j;
    char tmp[n][50], ch[50];
    
    int index[n];
    
    // 数组复制 
    for(i=0; i<n; i++) {
        strcpy(tmp[i], files[i]);
        for(j=0; tmp[i][j]!='_'; j++) {
            ch[j] = tmp[i][j];
        }
        ch[j] = '\0';
        index[i] = atoi(ch);
    }
    
    // 排序 
    for(i=0; i<n-1; i++) {
        for(j=i+1; j<n; j++) {
            if( index[i] > index[j] ) {
                int tt = index[i];
                index[i] = index[j];
                index[j] = tt;
                strcpy(ch, files[i]);
                strcpy(files[i], files[j]);
                strcpy(files[j], ch);
            }
        }
    }
}


int main() {
    initgraph(width, height, 0);
    setcaption("ByHansel");
    
    char ch;
    int i, j;
    short red, green, blue; 
    short *img_mx = (short *)malloc(width*height*3*sizeof(short));
    
    char files[50][50];
    int idx = 0;
    
    // 遍历 upload文件夹内所有文件 
    _finddata_t fileDir;
    long lfDir;
    // _findfirst():如果查找成功的话,将返回一个long型的唯一的查找用的句柄
    if( ( lfDir=_findfirst("download//*.myt", &fileDir) ) == -1l ) {
        printf("No file is found\n");
    } else {
//        printf("file list:\n");
        // _findnext():若成功返回0,否则返回-1
        do {
            strcpy(files[idx++], fileDir.name);
        } while( !_findnext( lfDir, &fileDir ) );
    }
    _findclose(lfDir);
    
    
    // 根据文件序号将文件在数组中排序 
    SortByIndex(files, idx);



    char PATH[50];
    int num_block = ceil(width*height*3.0/size/1024.0);
    
    // 组合分块
    for(i=0; i<num_block; i++) {
        sprintf(PATH, "%s%s", "download/", files[i]);
        FILE *fp;
        fp = fopen(PATH, "rb");
        printf("%s\n", PATH);
        
        for(j=0; j<size*1024; j++) {
            if( i*size*1024+j < width*height*3 ) {
                // 可以在此将分块数据进行发送 
                fscanf(fp, "%c", &ch);
                *(img_mx+i*size*1024+j) = (unsigned char)ch;
            } else {
                break;
            } 
        }
        fclose(fp);
    } 
    
    
    // 打印图像矩阵 
    for(i=0; i<width; i++) {
        for(j=0; j<height; j++) {
            red   = *(img_mx+3*(height*i+j)+0);
            green = *(img_mx+3*(height*i+j)+1);
            blue  = *(img_mx+3*(height*i+j)+2);
            putpixel(i, j, EGERGB(red, green, blue));
        }
    }
    
    // 保存图像
    PIMAGE pimg = newimage();                    
    getimage(pimg, 0, 0, getwidth(), getheight()); 
    saveimage(pimg, "receive.jpg");
    
    // 图像移动功能 
    int x=0, y=0, num=50;
    for (; is_run(); delay_fps(20)) {
        key_msg keyMsg = {0};
        while(kbhit()) {
            keyMsg = getkey();
            if(keyMsg.key == key_left) {
                x -= num;
            } else if(keyMsg.key == key_up) {
                y -= num;
            } else if(keyMsg.key == key_right) {
                x += num;
            } else if(keyMsg.key == key_down) {
                y += num;
            }
            cleardevice();
            for(i=0; x+i<width && i<width; i++) {
                for(j=0; y+j<height && j<height; j++) {
                    if(x+i>=0 && y+j>=0) {
                        red   = *(img_mx+3*(height*i+j)+0);
                        green = *(img_mx+3*(height*i+j)+1);
                        blue  = *(img_mx+3*(height*i+j)+2);
                        putpixel(x+i, y+j, EGERGB(red,green, blue));
                    }
                }
            }
        }
    }
    
    getch();
    free(img_mx);
    delimage(pimg);
    closegraph();
    return 0;
}

 

标签:file,int,编程,char,实验,str,printf,接字,include
来源: https://www.cnblogs.com/hanselhuang/p/15696574.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有