const int samples = 2048;
const int points = 10*10*4;
short int *memspace, *temp_mem;
memspace = (short int *)malloc(sizeof(short int)*samples*(points));
temp_mem = (short int *)malloc(sizeof(short int)*samples);
//unsigned char *pInData = (unsigned char *)_aligned_malloc(2*BurstSize, 4096);
//FILE *hs1,*hs2;
char str1[20],str2[20];;
t = clock();
unsigned long wow = sizeof(short int)*samples*(points);
printf("Size of short is %u and size of int short is %u\n", sizeof(short), sizeof(int));
//exit(0);
printf("The Value of sizeof here is %u words \n", wow);
printf("In terms of Bytes it is %fMB\n", (float)(wow/2)/(1024*1024));
for(short int i =0; i<points; i++){
//memspace[i] = i*1000;
sprintf(str1, "Textfile%d.bin",i);
//fprintf(hs,"memspace at this location is %d\n", memspace[i]);
for(short int k=0; k<2048; k++){temp_mem[k] = i+k;
// printf("Value of temp_mem is %d \n", temp_mem[k]);
}
//memory copy
//printf("Cannot memcpy %d\n", i);
if(i==0) memcpy(memspace + i*samples , temp_mem, sizeof(short int)*samples);
else memcpy(memspace + i*samples + 1 , temp_mem, sizeof(short int)*samples);
}
//All data is captured and stored to mewmory once,
//now is the time to store them all in the separate files
for(int i =0; i<points-1; i++){
sprintf(str1, "Textfile%d.txt",i);
printf("Cannot save to File...(%d)\n", i);
if(i==0)
Save16BitArrayToFile(memspace + i*samples , sizeof(short int)*samples/2, str1, ASCII);
else
Save16BitArrayToFile(memspace + i*samples+1 , sizeof(short int)*samples/2, str1, ASCII);
}