Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 23, 2009, 08:25 AM   #1
Averello
macrumors newbie
 
Join Date: Dec 2009
Problem opening a *.txt file in Xcode Command Line Application

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!

George
Averello is offline   0 Reply With Quote
Old Dec 23, 2009, 09:39 AM   #2
Detrius
macrumors 68000
 
Join Date: Sep 2008
Location: Asheville, NC
Those look like compiler errors. You should not be trying to *compile* a txt file.
Detrius is offline   0 Reply With Quote
Old Dec 23, 2009, 09:46 AM   #3
sammich
macrumors 601
 
sammich's Avatar
 
Join Date: Sep 2006
Location: Sarcasmville.
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)
__________________
Official MR IRC
Look at me, I'm own a bunch of things and everyone must know about every single one.
sammich is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Passing a text file into Xcode instead of using the command line (C language) hollabit Mac Programming 19 Mar 31, 2014 12:45 PM
Resolved: Trouble reading a .txt file in Xcode with C++ rayonix Mac Programming 2 Jan 4, 2014 05:03 PM
Command line tools & Xcode 5 & Mavericks ka-spot OS X Mavericks (10.9) 1 Oct 24, 2013 10:35 AM
Unable to download the Command Line Tools (Xcode 5 DP3) cili0 Mac Programming 4 Jul 25, 2013 02:01 PM
Xcode 4.6. Can't open .txt file thrill4rishabh Mac Programming 6 May 28, 2013 02:22 PM

Forum Jump

All times are GMT -5. The time now is 09:22 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC