Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Averello

macrumors newbie
Original poster
Dec 23, 2009
1
0
Good Morning,
I am trying to manipulate a *.txt file in a Command Line Application in Xcode.
There is a text file that has for example two lines, with words/phrases and some numbers.
All I want to do is to search for the numbers, save them in some variables, sum them and after, write them in a new file.
My problem is that when I make fopen I get an error

error: expected '=', ',', ';', 'asm' or '__attribute__' before each word of my file

I don't know what to do, and the problem is that I don't know very well programming in C.
I am trying to learn.
Any help for understanding the problem and solving it would be appreciated!

I am waiting in hope for your enlightement! :D

George :apple:
 
If you're programming in C, you don't need to use XCode. You can use TextWrangler (free), and write code in that, save it, and compile it from in Terminal with the command:

Code:
gcc -o your_program_name /path/to/your/program
For example, you have the file called my_prog.c on your desktop:
Code:
gcc -o my_cool_program ~/Desktop/my_prog.c

Rewrite your program in TextWrangler and try the above and see what errors you get.

(~ is your home directory in case you didn't know)
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.