Hi to all, The posting summery may be simple, but i am not able to fix the error.
Ok lets come to the problem. I am creating an Index File "Test.txt" on Serial Flash using FILESystem which holds 50,000 datas each one is 2 bytes.
Another File is xx.txt which holds same 50,000 datas each size is 4 bytes. Using following function.
//MAX_USERS =50000 int File_Write_Index (unsigned int no_ofData) { unsigned short count[MAX_USERS], i; FILE *fpt; fpt = fopen ("Test.txt","w"); if (fpt == NULL) { printf ("File not found!. Write Failed\n"); return 0; } else { for(i=0; i<MAX_USERS; i++)//MAX_USERS =50000 count[i] = 0x0000 + i; fwrite (&count[0], 2, MAX_USERS, fpt); fclose (fpt); printf("\r\nWrite Succeed"); return 1; } }
and the second function for 4 bytes data same as first one where i change the size as 4.
fwrite (&count[0], 4, MAX_USERS, fpt);
Actually i made this function for 1000 MAX_USERS. But now i want to make it for 5000.
But Creating buffer for 50000 will increase the RAM size. So i Created a line
unsigned long i=0; unsigned char j; for(k=0; k<MAX_USERS; ) { j=(unsigned char *)&k; fwrite (&j, 2, 1, fpt); } unsigned long j; for(k=0x11111111; k<0x11111111+MAX_USERS; k++) { j=(unsigned char *)&k; fwrite (&j, 2, 1, fpt); } But this one getting much time to read and write the files and even to search just for 1000 MAX_USERS. I am not able to go for more than 1000. The code does not print any errors. But its not working. while debugging it goes to Somewhere which i dont know. So i am here for your help and guidelines. Please tell me how to create a line to move my 50000 no of 2 and 4 bytes of datas into my corresponding files? I am using LPC2388.