Textfiles and xCode
Textfiles and xCode
- Subject: Textfiles and xCode
- From: Bob Austin <email@hidden>
- Date: Sun, 13 Mar 2005 14:02:15 -0800
Hi all,
I'm trying to use bbedit to create the text files and have them accessed by xCode in the Run log or via Terminal with the project's executable file.
does anyone know where the text files should be located in order for the code below to run?
I have many more similar sample projects. All of my projects are based on the Standard Tool template.
I would be happy to know if there is a way to create text files within xCode so that the project knows where it is and can use it?
I sure appreciate any help and or tips,
ABob
New bee
/* Read a text file of integers, and print the contents.
*/
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
/* Local Definitions */
FILE *fpIn;
FILE *fpOut;
int num1;
int num2;
/* Statements */
fpIn = fopen("P7-03.DAT", "r");
if (!fpIn)
{
printf("Could not open file\a\n");
exit (101);
} /* if open fail */
fpOut = fopen("RES.DAT", "w");
if (!fpIn)
{
printf("Could not open file\a\n");
exit (101);
} /* if open fail */
while ((fscanf(fpIn, "%d %d", &num1, &num2)) != EOF)
fprintf(fpOut, "%d %d %.2f\n", num1, num2, (num1 + num2 ) / 2.0);
fclose( fpIn );
fclose( fpOut );
return 0;
} /* main */
/* Expected Results:
1 2 3 4 5 6 7 8 9 10
*/ _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden