Simple File Dialog 用于在Windows和Linux上打开文件对话框的小型C库

网友投稿 628 2022-10-29

Simple File Dialog 用于在Windows和Linux上打开文件对话框的小型C库

Simple File Dialog 用于在Windows和Linux上打开文件对话框的小型C库

Simple File Dialog

A small C library for opening a file dialog on Windows and Linux.

Usage

sfd.c and sfd.h should be dropped into an existing project and compiled along with it — on Windows comdlg32 should be linked.

The library provides a function for open dialogs and one for save dialogs:

sfd_Options opt = { .title = "Open Image File", .filter_name = "Image File", .filter = "*.png|*.jpg",};const char *filename = sfd_open_dialog(&opt);if (filename) { printf("Got file: '%s'\n", filename);} else { printf("Open canceled\n");}

Both functions accept a sfd_Options struct pointer with settings for the file dialog — All fields of the sfd_Options struct are optional.

FieldDescription
.titleTitle for the file dialog window
.pathDefault directory
.filter_nameName used to describe the file filter
.filterFile filters separated by |

If the file dialog is canceled or an error occurs NULL is returned. sfd_get_error() will return an error string in the case of an error.

License

This library is free software; you can redistribute it and/or modify it under the terms of the MIT license. See LICENSE for details.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:React-Scope:在与您应用程序交互时可视化您的React组件
下一篇:Redis主从复制与哨兵模式
相关文章

 发表评论

暂时没有评论,来抢沙发吧~