i'm using this code...it's working but giving runtime failure..."stack around 'par' is correpted..
can somebudy tell me it's solution.
thanks
nj
Code:
#include "stdafx.h"
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
char buffer[100];
char* st;
float par[30][4],st1;
int i=0, j;
ifstream infile("test.dat");
while(infile)
{
j=0;
infile.getline(buffer,100);
st = strtok(buffer,",");
while (st != NULL)
{
st1=atof(st);
par[i][j]=st1;
//cout << par[i][j] << "\t";
j++;
st = strtok(NULL,",");
//cout <<"\t" ;
}
i++;
}
for(int a=0; a<30;a++)
{
for(int b=0; b<4; b++)
{
cout << par[a][b] << "\t";
}
cout << "\n" ;
}
return 0;
}