¶
strlen는 본 데( 보 ;;)
밍 미 놓 -_-;
밍 미 놓 -_-;
메는 보;;
면 대 리
¶
~cpp #include <stdio.h> #define BUFFER_SIZE 50 //string 를 . int strlen(char str[]) { int len=0; while(1) { if (str[len] == 0 || str[len] == '\0') break; len++; } return len; } // 문를 바. void exchange_char(char *a, char *b) { char tmp; tmp = *a; *a = *b; *b = tmp; } //를 . void reverse_array(char str[]) { int len=0, p=0; len = strlen(str); while(1) { if( (len-1)-p <= p ) break; exchange_char(&str[p], &str[len-1-p]); p++; } } void openiofiles(char* infilename,char* outfilename, FILE** fin, FILE** fout, char** buf[]) { *fin = fopen(infilename,"rt"); *fout = fopen(outfilename,"wt"); fgets(buf,BUFFER_SIZE,*fin); } void closeiofiles(FILE** fin, FILE** fout, char buf[]) { fputs(buf,*fout); fclose(*fout); fclose(*fin); } int main() { FILE *fin, *fout; char buf[BUFFER_SIZE]; // openiofiles("source.txt","result.txt",&fin,&fout,buf); // 만듭. reverse_array(buf); // . closeiofiles(&fin,&fout,buf); return 0; }