Specifications

Building and Running the Program
Developing a Simple Program
2-5
#ifdef FILEIO
/* clear char arrays */
for (i = 0; i < BUFSIZE; i++) {
scanStr[i] = 0 /* deliberate syntax error */
fileStr[i] = 0;
}
/* read a string from stdin */
scanf("%s", scanStr);
/* open a file on the host and write char array */
fptr = fopen("file.txt", "w");
fprintf(fptr, "%s", scanStr);
fclose(fptr);
/* open a file on the host and read char array */
fptr = fopen("file.txt", "r");
fseek(fptr, 0L, SEEK_SET);
readSize = fread(fileStr, sizeof(char), BUFSIZE, fptr);
printf("Read a %d byte char array: %s \n", readSize, fileStr);
fclose(fptr);
#endif
}
When FILEIO is undefined, this is a simple program that uses the standard
puts() function to display a hello world message. When you define FILEIO (as
you do in section 2.5, page 2-7), this program prompts for a string and prints
it to a file. It then reads the string from the file and prints it and a message
about its length to standard output.
2.4 Building and Running the Program
Code Composer Studio automatically saves changes to the project setup as
you make them. In case you exited from Code Composer Studio after the
previous section, you can return to the point where you stopped working by
restarting Code Composer Studio and using Project
Open.
Note: Resetting the Target DSP
If Code Composer Studio displays an error message that says it cannot
initialize the target DSP, choose the Debug
Reset DSP menu item. If this
does not correct the problem, you may need to run a reset utility provided
with your target board.