common-tasks

What to include in a Utility Library [closed]

房东的猫 提交于 2020-01-13 13:08:27
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 5 months ago . With more and more projects under my belt I find that I am often repeating many common tasks from project to project, client to client. So I have started to assemble a "utility" library, a collection of these common elements that are often repeated from project to project.

What to include in a Utility Library [closed]

爷,独闯天下 提交于 2019-12-06 04:36:28
Closed . This question is opinion-based . It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post . Closed 3 months ago . With more and more projects under my belt I find that I am often repeating many common tasks from project to project, client to client. So I have started to assemble a "utility" library, a collection of these common elements that are often repeated from project to project. So far I have utilities to resize images, export data grids to excel, send e-mails, and replace

How do you get a directory listing in C?

自闭症网瘾萝莉.ら 提交于 2019-11-26 16:09:20
How do you scan a directory for folders and files in C? It needs to be cross-platform. Clayton The following POSIX program will print the names of the files in the current directory: #define _XOPEN_SOURCE 700 #include <stdio.h> #include <sys/types.h> #include <dirent.h> int main (void) { DIR *dp; struct dirent *ep; dp = opendir ("./"); if (dp != NULL) { while (ep = readdir (dp)) puts (ep->d_name); (void) closedir (dp); } else perror ("Couldn't open the directory"); return 0; } Credit: http://www.gnu.org/software/libtool/manual/libc/Simple-Directory-Lister.html Tested in Ubuntu 16.04. Will Dean

How do you get a directory listing in C?

半世苍凉 提交于 2019-11-26 04:42:44
问题 How do you scan a directory for folders and files in C? It needs to be cross-platform. 回答1: The following POSIX program will print the names of the files in the current directory: #define _XOPEN_SOURCE 700 #include <stdio.h> #include <sys/types.h> #include <dirent.h> int main (void) { DIR *dp; struct dirent *ep; dp = opendir ("./"); if (dp != NULL) { while (ep = readdir (dp)) puts (ep->d_name); (void) closedir (dp); } else perror ("Couldn't open the directory"); return 0; } Credit: http://www