各位大侠,帮帮忙吧,快急死了.............. 我想做一个矩阵运算,是550x35000的矩阵,我使用的是CArray类定义的二维矩阵来进行计算,但是程序也不出错,也不出数据,内存使用104MB,问朋友说是数组太大了,要我使用动态数组写磁盘,哎我也不会呀请问各位高手又没有解决的办法? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void LoadIndex(const char *IndexFilePath){ struct ChCharNode *ptr, *ptr1; struct FileChar *pfc, *pfc1; FILE *indexfile0; /* 索引文件指针 */ int ChCount; /* 汉字个数 */ int FCount; /* 文件个数 */ int PCount; /*位置个数 */ char FilePath[100]; //unsigned short Ch, t; /* 汉字 */ char *term; int i, j; CString Ch=_T(""); indexfile0 = fopen(IndexFilePath, "r");/*here has some question*/ if(indexfile0==NULL) { AfxMessageBox("文件不能打开!"); } else { fscanf(indexfile0, "短语个数:%d\n", &ChCount); for (i = 0; i < ChCount; i++) { fscanf(indexfile0, "%s\n",Ch); if( Ch == "" ) { fscanf(indexfile0, "%s\n",Ch); } term=new char[Ch.GetLength()]; strcpy(term,(LPCTSTR)Ch);///问题就出在这里当加在第18602个词时就出错了 fscanf(indexfile0, "文件个数:%d\n", &FCount); for (j = 0; j < FCount; j++) { fscanf(indexfile0, "%s\n", FilePath); fscanf(indexfile0, "出现次数:%d\n", &PCount); if(!ChIndex) { ChIndex=new struct ChCharNode; ChIndex->ChChar=term; ChIndex->FCList=new struct FileChar; ChIndex->FCList->FilePath=new char[strlen(FilePath)+1]; strcpy(ChIndex->FCList->FilePath,FilePath); ChIndex->FCList->CharacterCount=PCount; ChIndex->FCList->next=NULL; ChIndex->next=NULL; } else { for (ptr=ChIndex,ptr1=ChIndex;ptr;ptr1=ptr,ptr=ptr->next) if(ptr->ChChar==Ch) { for(pfc=ptr->FCList,pfc1=ptr->FCList;pfc;pfc1=pfc,pfc=pfc->next) ; if(!pfc) { pfc1->next=new struct FileChar; pfc1=pfc1->next; pfc1->FilePath=new char[strlen(FilePath)+1]; strcpy(pfc1->FilePath,FilePath); pfc1->CharacterCount=PCount; pfc1->next=NULL; } break; } if(!ptr) { ptr1->next=new struct ChCharNode; ptr1=ptr1->next; ptr1->ChChar=term; ptr1->FCList=new struct FileChar; ptr1->FCList->FilePath=new char[strlen(FilePath)+1]; strcpy(ptr1->FCList->FilePath,FilePath); ptr1->FCList->CharacterCount=PCount; ptr1->FCList->next=NULL; ptr1->next=NULL; } } //delete term; } fscanf(indexfile0, "--------------------------\n"); } fclose(indexfile0); }} 如何控制CreateFile读取文件的大小 关于24位bmp图像转换成8位bmp的问题 发送邮件问题 如何响应工具栏下拉框的消息? 自定义协议的问题 在使用webbrowser时,能否通过DOM得到所有可见的页面文本? 字符串读取的问题,请小三等专家进来。 不能用读写方式打开文件吗?为什么? 关于VC++工程的打包问题,在线等!! 改变属性页的背景色,急,在线等候 非常着急 VC高手请进
{
struct ChCharNode *ptr, *ptr1;
struct FileChar *pfc, *pfc1; FILE *indexfile0; /* 索引文件指针 */
int ChCount; /* 汉字个数 */
int FCount; /* 文件个数 */
int PCount; /*位置个数 */
char FilePath[100];
//unsigned short Ch, t; /* 汉字 */
char *term;
int i, j;
CString Ch=_T("");
indexfile0 = fopen(IndexFilePath, "r");/*here has some question*/
if(indexfile0==NULL)
{
AfxMessageBox("文件不能打开!");
}
else
{
fscanf(indexfile0, "短语个数:%d\n", &ChCount);
for (i = 0; i < ChCount; i++)
{
fscanf(indexfile0, "%s\n",Ch);
if( Ch == "" )
{
fscanf(indexfile0, "%s\n",Ch);
}
term=new char[Ch.GetLength()];
strcpy(term,(LPCTSTR)Ch);///问题就出在这里当加在第18602个词时就出错了 fscanf(indexfile0, "文件个数:%d\n", &FCount); for (j = 0; j < FCount; j++)
{
fscanf(indexfile0, "%s\n", FilePath);
fscanf(indexfile0, "出现次数:%d\n", &PCount);
if(!ChIndex)
{
ChIndex=new struct ChCharNode;
ChIndex->ChChar=term; ChIndex->FCList=new struct FileChar;
ChIndex->FCList->FilePath=new char[strlen(FilePath)+1];
strcpy(ChIndex->FCList->FilePath,FilePath);
ChIndex->FCList->CharacterCount=PCount; ChIndex->FCList->next=NULL;
ChIndex->next=NULL;
}
else
{
for (ptr=ChIndex,ptr1=ChIndex;ptr;ptr1=ptr,ptr=ptr->next)
if(ptr->ChChar==Ch)
{
for(pfc=ptr->FCList,pfc1=ptr->FCList;pfc;pfc1=pfc,pfc=pfc->next)
;
if(!pfc)
{
pfc1->next=new struct FileChar;
pfc1=pfc1->next;
pfc1->FilePath=new char[strlen(FilePath)+1];
strcpy(pfc1->FilePath,FilePath);
pfc1->CharacterCount=PCount;
pfc1->next=NULL;
}
break;
}
if(!ptr)
{
ptr1->next=new struct ChCharNode;
ptr1=ptr1->next;
ptr1->ChChar=term;
ptr1->FCList=new struct FileChar;
ptr1->FCList->FilePath=new char[strlen(FilePath)+1];
strcpy(ptr1->FCList->FilePath,FilePath);
ptr1->FCList->CharacterCount=PCount;
ptr1->FCList->next=NULL;
ptr1->next=NULL;
}
} //delete term;
}
fscanf(indexfile0, "--------------------------\n");
}
fclose(indexfile0);
}
}