我有带有 vs2010 的 Windows 8,当我运行这部分程序时,显示此错误:运行时检查失败 #2 - 变量“seqA”周围的堆栈已损坏。..................................................... ......................
#include <iostream.h>
#include <stdio.h>
#include <string>
#include<stdlib.h>
#include <fstream>
using namespace std;
int main(){
int lenA = 0;
int lenB = 0;
FILE * fileA, * fileB;
char holder;
char seqA[10], seqB[10];
/*open first file*/
fileA=fopen("c:\\str1.fa", "r");
/*check to see if it opened okay*/
if(fileA == NULL) {
perror ("Error opening 'str1.fa'\n");
exit(EXIT_FAILURE);
}
/*open second file*/
fileB = fopen("c:\\str2.fa", "r");
/*check to see if it opened okay*/
if(fileB == NULL) {
perror ("Error opening 'str1.fa'\n");
exit(EXIT_FAILURE);
}
/*measure file1 length*/
while(fgetc(fileA) != EOF) {
holder = fgetc(fileA);
seqA[lenA]=holder;
lenA++;
}
lenA--;
fclose(fileA);
holder='0';
/*measure file2 length*/
while(fgetc(fileB) != EOF) {
holder = fgetc(fileB);
seqB[lenB]=holder;
lenB++;
}
lenB--;
fclose(fileB);
此错误的链接图片。