• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Development Tools » Code Composer Studio » Code Composer Forum » fprintf does not work in CCS simulator !!!
Share
Code Composer Studio
  • Forum
  • Announcements
Options
  • Subscribe via RSS
Common Questions
  • Code Composer Studio Forum Usage Guidelines

  • Resources
  • Code Composer Studio (CCStudio) Product Folder
  • Troubleshooting CCS
  • CCS Wiki
  • Download CCS
  • Order CCS
  • Tools Insider Blog
  • Bug Tracking
  • fprintf does not work in CCS simulator !!!

    fprintf does not work in CCS simulator !!!

    • Xuedong
      Posted by Xuedong
      on Aug 01 2008 17:47 PM
      Prodigy150 points

      Hi, all,

      I have a question: anyone knows a way to make fprintf work in CCS simulator?

      I wrote a short C program to read 3 lines of integer data (in input.txt) into an array of size 3, and then write them from the array to a file (output.txt). I use fscanf to read and fprintf to write respectively. I ran the program successfully in the unix environment and confirmed that the 3 data have been written to the output.txt file correctly.

      However, when I ran the same program in CCS simulator, I confirmed that the 3 data have been read to the array defined in the program successfully, but the data were not written from the array to output.txt successfully. The size of output.txt is always 0, after running the program. In other words, fscanf works but fprintf does not work in CCS simulator.

      Anyone can guide me what's wrong with the use of fprintf in CCS simulator? Did I miss anything?

      Many thanks.

      csl DSP/BIOS dsp/bios linker
      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • TimHarron
      Posted by TimHarron
      on Aug 05 2008 12:50 PM
      Genius16720 points

      Hi Xuedong,

      I do not know of any bugs that prevent fprintf from functioning in the Simulator, but there are some common places to check for errors. First off I suggest that you ensure that you have a sufficient stack and heap size. Many of the RTS functions require the use of both (especially printf) so you may want to try beefing the sizes of both up a bit to see if it helps.

      Additionally which Simulator are you working with and in which version of CCS?

      -Tim

      ---------------------------------------------------------------------------------------------------------
      Please click the Verify Answer button on this post if it answers your question.
      --------------------------------------------------------------------------------------------------------- 

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Xuedong
      Posted by Xuedong
      on Aug 05 2008 13:11 PM
      Prodigy150 points

      Thanks, Tim.

       I am using CCS 3.3 and C6416 Device Cycle Accurate Simulator.

       Strangely, I can see the output data in CCS stdout window when using printf, while the output file size is 0 when using fprintf. If this is the issue of stack and/or heap size, I guess that both printf and fprintf will not work.

       Anyway, I will check stack/heap size as you suggested. Thanks.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • Xuedong
      Posted by Xuedong
      on Aug 05 2008 13:47 PM
      Prodigy150 points

      Hi, Tim,

       Now it is working.

      After adding fclose(), I saw the output data in the output file, as expected. Seems to me that fclose is needed in CCS, while in the unix environment, it is not needed.

      Anyway, it solves the problem. Thank you for your advice.

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    • TimHarron
      Posted by TimHarron
      on Aug 05 2008 13:58 PM
      Genius16720 points

      Good to know. I am glad to hear you got it working.

      -Tim

      ---------------------------------------------------------------------------------------------------------
      Please click the Verify Answer button on this post if it answers your question.
      --------------------------------------------------------------------------------------------------------- 

      Report Abuse
      • Reply
      You have posted to a forum that requires a moderator to approve posts before they are publicly available.
    TI E2E™ Community
    • Support Forums
    • Blogs
    • Videos
    • Groups
    • Site Support & Feedback
    • Settings
    TI E2E™ Community Groups
    • TI University Program
    • Make the Switch
    • Microcontroller Projects
    • Motor Drive & Control
    Other Communities
    • Deyisupport
    • Designsomething.org
    • beagleboard.org
    • TI on Element 14
    • TI on TechXchangeSM
    Other Technical & Support Resources
    • WEBENCH® Design Center
    • Product Information Centers
    • Technical Documents
    • TI Design Network
    • TI Technical Articles
    • TI Training

    All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

    Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

    Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
    TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

    TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
    embedded processors, along with software, tools and the industry’s largest sales/support staff.

    © Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
    Trademarks | Privacy Policy | Terms of Use