>怎麼一個人也沒有阿</P>[em03]
>這個是對2進制文件的操作</P><
>我用的是一個字符一個字符的操作方法</P>[em04]
>問題解決了</P><
>不用回了</P>[em01]
>不知道你找出的问题在那儿,我判断是alloca和malloc的误用。c++中对指针(内存)的操作总是容易出错,这些系统函数的使用,最好先仔细看看help。</P>
>alloca:</P>
>Allocates temporary stack space.</P>
>alloca allocates size bytes on the stack; the allocated space is automatically freed up when the calling function exits.</P>
>malloc:</P>+ ]6 Z7 g* P$ P Y! c( X4 z* f
>malloc allocates a block of size bytes from the memory heap. It allows a program to allocate memory explicitly as it抯 needed, and in the exact amounts needed.</P>
>Allocates main memory.The heap is used for dynamic allocation of variable-sized blocks of memory. Many data structures, for example, trees and lists, naturally employ heap memory allocation.</P>
>以下是改后的代码</P>; ]7 t" w \& z) d g2 d/ y }, O# L
>//---------------------------------------------------------------------------</P>$ D) g3 D/ S4 ]$ y; S5 K
>#include <vcl.h>
>#include "Unit1.h"
> getcwd(sPath,sizeof(sPath));
>free(sPath); free(stream);此两句也有问题。</P>+ d5 Y: z' q9 J0 l/ e
>char sPath[MAXPATH];不需要释放;</P>
>fclose(stream)已经起到free(stream)的作用</P>6 Y3 [' l1 i- a% z( I+ {+ D" u
>我已經改成塊處理的方法了</P><
>謝謝你</P>[em01]
| 欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) | Powered by Discuz! X2.5 |