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.

CCS: how to use file.h?

Tool/software: Code Composer Studio

hello,

I currently use CCS6.0.1. I need to load a bin file in my project, and call "file.h" in the path "C:\ti\ccsv6\tools\compiler\c2000_6.2.7\include" , I want to know how this open() function is called? thank you!

  • I'm not sure I understand the question.  I think that in your source code, you have ...

    #include "file.h"

    When you build, the compiler issues an error about not being able to find or open file.h.  For now, I presume this is your problem.

    Please see the section titled The Search Path for #include Files in the C28x compiler manual.

    Thanks and regards,

    -George

  • Hi,

    CCS supports standard C library functions such as fopen, fclose, fread, fwrite for file I/O operations.

    Suppose you have an audio signal stored as a binary file in this directory (C:\data\AudioTest.pcm). You can easily open and close this file in this way:

    #include <stdio.h>
    #include <stdlib.h>
    #include "tistdtypes.h"  /* Standard Types File. This Header file let you
     export C primitive data types into TI Standard data types*/
    .
    .
    .
    .
    .
    void main()
    {
    	FILE *fp1;                           
    
    	fp1 = fopen("C:\data\AudioTest.pcm", "rb");	// Open  file
    .
    .
    .
    .
    .
    	fclose(fp1);                                // Close file
    	
    }

    Another important matter is that when you create a header file it is better to have it in the folder of project instead of linking it's copy to workspace. This will help you when you want to take the project from this PC to another so that no header file will be missed in the new computer. However you can easily include a header file from another directory other than CCS Workspace in this way:

    #include "C:/a/b/myheader.h"

    myheader is the name of header file and it's directory is C:/a/b.

    I hope this helps you. Please let me know if you have any related question and want to get more examples and details about how to create and include header files and open/close binary files.

    Regards,

    Hossein

  • Since it has been a while, I presume you have resolved your problem.  I'd appreciate hearing how you resolved it.  

    Thanks and regards,

    -George