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.

stat( ) function or equivalent in CCS v3.3

Hi

I am compiling an image compression code on the DSK6713. The code is originally written in C for windows. I am porting the code on the DSP. a large part of code is compatible with standard C and DSP CCS. I am using CCS V3.3. but i am stuck at one part where the code has following include file:

#include <sys/stat.h>

the ccs gives the error : could not open <sys/stat.h>

now the inside of code I have a stat structure and a function stat( ).

basically these are windows C library functions.

the function stat is used to examine the attributes of files. They return the attribute information in a struct stat object. 

function is declared in the header file sys/stat.h.

 int stat (const char *filename, struct stat *buf)
Now here is the listing of a portion of my code where the problem arises:

struct stat status;
int res;

res = stat(PtrStructCodingPara->InputFile, &status);
if (res != 0)
{
return (-1);
}
img_len = status.st_size;

we can clearly see that there is a stat( ) function call and the returning structure is stored in the stat structure named status here.

So can somebody help me how can i implement these windows library functions and structures on DSK6713 in CCS v3.3. these windows header files when included in CCS contain a series of other header files and give error for WIN_32 target only.

i shall be very thankful to you if you tell me a way around.

  • The function stat is not part of the ANSI standard for C.  It is not provided with the TI compiler.  You can probably determine the size of a file by using the standard functions fseek and ftell.

    Before doing that, I recommend you read the section titled The C I/O Functions in the C6000 compiler manual.  There is a big difference between how C I/O functions (i.e. fseek, ftell) work on a hosted system like a laptop and an embedded system like a DSK6713.

    Thanks and regards,

    -George