[c++] 파일 확장자 변경
#include <iostream>
#include <cstdio>
#include <cstring>

int main() {
    const char* oldFile = "oldfile.txt";
    const char* newFile = "newfile.dat";
    
    if (rename(oldFile, newFile) == 0) {
        std::cout << "파일 이름 변경 성공" << std::endl;
    } else {
        std::perror("파일 이름 변경 실패");
    }

    return 0;
}

위 예제는 C++을 사용하여 파일 이름을 변경하는 방법을 보여줍니다. rename 함수를 사용하여 기존 파일 이름과 변경할 새 파일 이름을 지정합니다.

프로그램을 실행하면 파일 이름 변경이 성공했는지 또는 실패했는지에 대한 메시지가 출력됩니다.

참고문헌: