其格式如下毕启
OPENFILENAME ofn
char path[MAX_PATH]
static TCHAR szFilter[] = TEXT ("Text Files (*.TXT)\0*.txt\0") \
TEXT ("ASCII Files (*.ASC)\0*.asc\0"知毕) \
TEXT ("All Files (*.*)\0*.*\0\0")
ofn.lStructSize = sizeof (OPENFILENAME)
ofn.hwndOwner = hwnd
ofn.hInstance = NULL
ofn.lpstrFilter = szFilter
ofn.lpstrCustomFilter = NULL
ofn.nMaxCustFilter = 0
ofn.nFilterIndex = 0
ofn.nMaxFile = MAX_PATH
ofn.nMaxFileTitle = MAX_PATH
ofn.lpstrInitialDir = NULL
ofn.lpstrTitle = NULL
ofn.Flags = 0 // Set in Open and Close functions
ofn.nFileOffset = 0
ofn.nFileExtension = 0
ofn.lpstrDefExt = TEXT ("txt")
ofn.lCustData = 0L
ofn.lpfnHook = NULL
ofn.lpTemplateName = NULL
ofn.hwndOwner = hwnd
ofn.lpstrFile = path
ofn.lpstrFileTitle = NULL
ofn.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT
GetOpenFileName (&ofn) //打开文件对话框
GetSaveFileName(&ofn)//保存文件对话搭数芹框
只枝斗有用WinAPI的,需要头文件颂渣windows.h和commdlg.h:#include <windows.h>猛樱磨
#include <commdlg.h>
int main(void)
{
OPENFILENAME ofn
ZeroMemory(&ofn,sizeof(ofn))
ofn.lStructSize = sizeof(ofn)
ofn.lpstrFile[0] = '\0'
ofn.lpstrFilter = TEXT("ALL\0*.*\0")
ofn.nFilterIndex = 1
ofn.lpstrFileTitle = NULL
ofn.nMaxFileTitle = 0
ofn.lpstrInitialDir = NULL
ofn.hwndOwner = NULL
ofn.Flags = OFN_EXPLORER |OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST
GetOpenFileName(&ofn)
return 0
}
Linux中浏览裂姿当前目录下所肆镇绝有以".c"为后缀名的文件,可以使用ls命令,旅或直接执行如下命令:
ls *.c要获取更多信息可以使用ls命令的-l参数
ls -l *.c欢迎分享,转载请注明来源:内存溢出
评论列表(0条)