- 论坛徽章:
- 0
|
- #include <stdio.h>
- #include <stdlib.h>
- int main ()
- {
- int i;
- char s[100];
- FILE *stream1, *stream2;
-
- stream1 = fopen ("./test1.txt", "r");
- stream2 = fopen ("./test2.txt", "w");
- fputs (fgets (s, 100, stream1), stream2);
- fclose (stream1);
- fclose (stream2);
-
- return (0);
- }
复制代码
- #include <stdio.h>
- #include <stdlib.h>
- int main ()
- {
- int i;
- char s[100];
- FILE *stream;
-
- stream = fopen ("./test1.txt", "r");
- fgets (s, 100, stream);
- freopen ("./test2.txt", "w", stream);
- fputs (s, stream);
- fclose (stream);
-
- return (0);
- }
复制代码
就以上兩段代碼, 請問那個的效能較高? 為什麼??
再問一下還有更好的作法嗎??
[ 本帖最后由 暴BB 于 2005-11-19 14:43 编辑 ] |
|