fillbox.c

来自「这是一个用c语言和MiniGUI工具编写的数据采集服务器程序」· C语言 代码 · 共 54 行

C
54
字号
#include "fillbox.h"#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include <string.h>#include <sys/stat.h>#include <sys/time.h>#include <sys/types.h>#include <unistd.h>#include <pwd.h>#include <errno.h>void fill_box(HWND hDlg, const char* path, int boxid){	struct dirent* dir_ent;	DIR* dir;	struct stat ftype;	char fullpath[PATH_MAX+1];//	SendDlgItemMessage (hDlg, boxid, LB_RESETCONTENT, 0, (LPARAM)0);	if ((dir = opendir (path)) == NULL)		return;	while ((dir_ent = readdir(dir)) != NULL) 	{		strncpy(fullpath, path, PATH_MAX);		strcat(fullpath, "/");		strcat(fullpath, dir_ent->d_name);		if(stat(fullpath, &ftype) < 0)			continue;		//		if (S_ISDIR(ftype.st_mode))//			SendDlgItemMessage (hDlg, IDL_, LB_ADDSTRING, 0, (LPARAM)dir_ent->d_name);		if (S_ISREG (ftype.st_mode)) 		{		LISTBOXITEMINFO lbii;		lbii.string = dir_ent->d_name;		lbii.cmFlag = CMFLAG_BLANK;		lbii.hIcon = 0;		SendDlgItemMessage (hDlg, boxid, LB_ADDSTRING, 0, (LPARAM)&lbii);		}	}	closedir (dir);	}char* itoa(int i, char* a){	if(a == NULL)		return NULL;	sprintf(a, "%d", i);	return a;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?