fread 문제 인듯한데요.. 도와주세요
글쓴이: changdoc / 작성시간: 수, 2008/05/28 - 4:55오전
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { FILE *fp; fp = fopen("changdoc.txt","w+"); unsigned int temp,read; for(temp=0;temp<500;temp++) fwrite(&temp,4,1,fp); for(temp=0;temp<500;temp++){ fseek(fp,4*temp,0); fread(&read,4,1,fp); printf("%d\n",read); if(temp%20==0)system("PAUSE"); } fclose(fp); return 0; }
Forums:
프린트 문이...
10이 넘어가니까 2618 머 이렇게 막 기하급수 적으로 숫자 커지면서 출력이 되네요;
0
1
2
3
4
5
6
7
8
9
10
11
12
13
이걸 기대했는데 뭐가 문제죠?
Changdoc's Tobacco story... :::::Be the Optimist!~
fopen에 b옵션 추가
이 부분을
fp = fopen("changdoc.txt","w+");
이렇게
fp = fopen("changdoc.txt","wb+");
--
같은 질문을 연달아 3번씩하는 도배(?)는 자제 부탁...
아!^ㅡ^ 감사합니다!~ ㅠㅠ
근데 이거 글 삭제는 어떻게 할까요?;;;
-ㅁ-;;; 저두 모르게 너무 ㅠㅠ 흥분;;
Changdoc's Tobacco story... :::::Be the Optimist!~
댓글 달기