Contents

조회 수 859 댓글 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
번호 분류 제목 글쓴이 날짜 조회 수
789 Develop [c] 패킷 에널라이저 예제 소스(성안당) file hooni 2013.04.23 6960
788 Develop [c++] 트리컨트롤 스텝 2 예제.. file hooni 2013.04.23 6968
787 Develop [c] 단기과정[01/24] 정렬 알고리즘 hooni 2003.04.23 6970
786 Develop [web] 웹 연동 프로그램 모음.. file hooni 2013.04.23 6975
785 Develop [c] 소켓 프로그래밍 요약.. hooni 2003.04.23 6986
784 Develop [c++] 템플릿(Template) 예제 소스.. file hooni 2013.04.23 6992
783 Develop [js] 점점 커지는 새창.. hooni 2003.04.23 7011
782 Develop [php] 메모장 - 웅지학원 ([c] mysql 백업프로그램 포함) file hooni 2003.04.23 7013
781 Develop 도메인 관련 솔루션 분석할 거.. ㅋㄷ file hooni 2013.04.23 7013
780 Develop [c][java] 소켓 프로그래밍(채팅 서버 C, 클라이언트 Java) file hooni 2003.04.23 7025
779 Develop [js] 큐 형식으로 배열사용.. ㅋㅋ hooni 2013.04.23 7026
778 Develop [js] 이미지 미리 로딩하기 hooni 2003.04.23 7027
Board Pagination Prev 1 ... 28 29 30 31 32 33 34 35 36 37 ... 98 Next
/ 98