How can i use the function "fprintf()" in PSoCCreator 2.0

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

   

*******************************************************************************/
void main()
{
    ...

   


    FILE *fp;

   

....

   

fp = fopen( "Slave.txt", "w" ); // Open file for writing
fprintf(fp, " %u %u\n", Array[0],Array[1]);

   

....

   

 

   

}

   

 is that correct?

0 Likes
1 Reply
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Short answer: no, this won't work.

   

Long answer: where do you intend the file to be written to? There is no fixed disk available on the PSoC, nor is there any operating system available handling the file system.

   

If you want to write to a SD card, look at the emfile component: http://www3.cypress.com/?rID=58694

0 Likes