Ovo je samo demo varijanta na komandnoj liniji-hvala Bogu da nisam pokusavao da pokrenem na serveru...
Petlja koja prolazi kroz sadrzaj dir je preuzeta iz libc reference.
Code:
#include <stdio.h>
#include "html-lib.h"
#include "cgi-lib.h"
#include "string-lib.h"
#include <stdlib.h>
#include <dirent.h>
#include <stddef.h>
#include <sys/types.h>
#include <string.h>
#include <gd.h>
int main() {
//html_header();
DIR *dp;
struct dirent *ep;
const char *x;
dp = opendir ("./");
printf("JPEG fajlovi su:\n");
//if (dp != NULL)
//{
while (ep = readdir (dp)) {
x = strstr(ep->d_name , ".");
if ( strcmp( x , ".jpg") == 0 )
printf(" %s\n",ep->d_name);
}
(void) closedir (dp);
return 0;
}
#include <stdio.h>
#include "html-lib.h"
#include "cgi-lib.h"
#include "string-lib.h"
#include <stdlib.h>
#include <dirent.h>
#include <stddef.h>
#include <sys/types.h>
#include <string.h>
#include <gd.h>
int main() {
//html_header();
DIR *dp;
struct dirent *ep;
const char *x;
dp = opendir ("./");
printf("JPEG fajlovi su:\n");
//if (dp != NULL)
//{
while (ep = readdir (dp)) {
x = strstr(ep->d_name , ".");
if ( strcmp( x , ".jpg") == 0 )
printf(" %s\n",ep->d_name);
}
(void) closedir (dp);
return 0;
}
Ag + Na -> Xe