New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

Start a Discussion

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Programming C on Xcode

Post Reply New Thread Subscribe

Thread Tools

Member Since: Jan 23, 2012
Posts: 1
MartaC is on a distinguished road

MartaC is offline
I have a C program that among many things I want it to read the input from a file and write it in another file. The problem with the input file and the output file is the same. Unless I write the whole path for the file, it does not recognize the fopen instruction.

I will include the piece of code so I can explain myself better: If I write:
PHP Code:
outfile fopen("UnifE-n51-k5""w");
fprintf(outfile,"a \t b \t ajuste \t media \n");
nothing happens and the address for the outfile is NULL.
However if I give the entire path for the file
PHP Code:
outfile fopen("/Users/Marta/Documents/VRPStochastic/UnifE-n51-k5""w");
fprintf(outfile,"a \t b \t ajuste \t media \n");
Works fine. I know I can do this all the time, but I do write a lot of code for my academic research and I don't want to remember the entire path for every program. Besides my colleague works on Windows and if I get part of his code I have to change it to adjust it to Xcode, which is a waste of time.

Thanks a lot for your help.
QUOTE Thanks

Post Reply New Thread Subscribe

« Mac Script Problems | Where can I find Jar Bundler? »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
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
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Starter
Last Post
XCode 4 ? tessando OS X - Development and Darwin 8 03-14-2011 08:15 PM
Programming in xcode katlb Switcher Hangout 1 01-21-2011 08:07 PM
New to programming. Having trouble with Xcode Chris23 OS X - Development and Darwin 1 11-23-2010 06:51 PM
C++ Programming with XCode 2 novicew OS X - Apps and Games 7 09-24-2009 02:02 AM
Programming basic C in Xcode DrQuincy OS X - Development and Darwin 4 01-16-2008 03:22 PM

All times are GMT -4. The time now is 01:03 AM.

Powered by vBulletin
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Welcome to

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!

(4 digit year)

Already a member?