Contents

조회 수 899 댓글 0
Atachment
첨부 '1'
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

사진 파일 정렬하고 차례대로 넘버링 하려고 만듦 ㅋㅋ


#include <stdio.h>
#include <unistd.h>
#include <dirent.h>
#include <string.h>

int main(){
    DIR *dir_info;
    struct dirent *dir_entry;
    char new_name[128];
    int i;

    //mkdir( "test_A"     , 0755);

    dir_info = opendir( ".");

    if ( NULL != dir_info){
        //while( (dir_entry = readdir( dir_info)) ){
        for(i =0; (dir_entry = readdir( dir_info)); i++){
            if( strstr(dir_entry->d_name, ".jpeg") > 0 ){
                printf( "%s\n", dir_entry->d_name);

                memset(new_name, 0x00, 128);
                sprintf(new_name, "IMG_%04d.JPG", i);
                rename(dir_entry->d_name, new_name);
            }
        }
        closedir( dir_info);
    }
}



?

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
577 Develop [c] 레포트용으로 제출했던 여러 소스코드 모음 file hooni 2003.04.23 8121
576 Develop [c] 로또(Lotto) 번호 생성기 file hooni 2013.04.23 7193
575 Develop [c] 마우스 따라다니는 고양이 - 네코95 (WinAPI) file hooni 2013.04.23 7968
574 Develop [c] 맵서치인 듯(옛날 컴에서 찾은 자료) file hooni 2013.04.23 6919
573 Develop [c] 메세지 프로그램 (Server - Agent - Client) file hooni 2013.04.23 6481
572 Develop [c] 메시지큐(Message Queue) 설명.. (joinc) hooni 2013.04.23 14310
571 Develop [c] 무선 Radius Server 자료.. file hooni 2013.04.23 7284
570 Develop [c] 문자열 str_shift 예제.. file hooni 2013.04.23 6862
569 Develop [c] 문자열 뒤집기 (문자열 거꾸로 출력하는 간단소스) hooni 2003.04.23 10060
568 Develop [c] 문자열 뒤집기 초간단 샘플 코드 ㅎㅎ hooni 2013.04.23 7136
567 Develop [c] 문자열 라이브러리 최신버전 file hooni 2003.04.23 7223
566 Develop [c] 문자열 자르는 함수(strtok) 예제 hooni 2013.04.23 12226
Board Pagination Prev 1 ... 18 19 20 21 22 23 24 25 26 27 ... 71 Next
/ 71