This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

FILE operation (fopen, fwrite, fread) problems in CCS5

Hi all,

I had a problem in ccs5, when i use C FILE operations. (fread, fwrite, fopen).

Problems:

1. When I write fopen in 'C' file. It will get the file pointer address even if the file is not present. (means fopen is success not returning NULL)

ex:  fopen("input.flac","rb");

input.flac has not placed at debug folder or inside debug folder.

2. when i read file, it reads normally but the data is not the reading file content (input file) . Below is the sample program where i found these issues:

#include <stdio.h>
#include <stdlib.h>

void main(void) {

 FILE *fp, *fp_w;
 int bytes, bytestoread=2048;
 char buf[4096];

 fp = fopen("1.flac","rb");
 if(fp == NULL)
 {
  printf("\n file can not be opened\n");
  exit(0);
 }

 fp_w = fopen("1_write.flac","wb");
 if(fp_w == NULL)
 {
  printf("\n file can not be opened\n");
  exit(0);
 }

 bytes = fread(buf, 1, bytestoread, fp);

 fwrite(buf, 1, bytes, fp_w);

 printf("\n bytes : %d\n", bytes);

 fclose(fp);
 fclose(fp_w);

 return;
}

and iam using 5.1.0.08012 and compiling with Optimisation level O0, speed 0.

but these problems does not occured in CCSv4.0.2.

Please help me in this issue, where iam missing something to enable for file operations or any options need to select in CCSv5.

 

Thanks in advance,

Vinay.