Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Dec 23, 2009, 07: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, 08: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, 08: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
Slow news day? Never fear, Digitimes is here. Serving up free hits for techblogs everywhere.
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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Trouble reading a .txt file with Xcode C++ aprofetto Mac Programming 11 Jan 15, 2013 11:08 PM
Making a log file in Xcode Application arjit Mac Programming 6 Nov 23, 2009 06:04 PM
xcode command line c++ issues dvince2 Mac Programming 3 Jan 2, 2009 05:14 AM
Always open .txt files in textmate. Kalixa Mac Applications and Mac App Store 3 Aug 20, 2007 01:30 PM
Xcode 2 Freezes in C++ Command line tool CookieMook Mac Programming 7 Oct 1, 2006 09:39 PM


All times are GMT -5. The time now is 12:52 PM.

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

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