Hello. I have recently moved from programming in C in Windows (Using Visual Studio) to programming C in a Mac (using Xcode). I am still learning to master Xcode, but one of the first problems I encounter is one related with writing in a file.
In Windows I had no problem in writing:
[code]
FILE *outfile;
outfile = fopen("UnifE-n51-k5", "w");
fprintf(outfile,"a \t b \t ajuste \t media \n");
fprintf(outfile,"================================= =\n");
fclose(outfile);
[\code]
However when trying to copy that piece of code into my Mac program I have to give the whole path to the outfile.
[code]
FILE *outfile;
outfile = fopen("/Users/Marta/Documents/VRPStochastic/UnifE-n51-k5", "w");
fprintf(outfile,"a \t b \t ajuste \t media \n");
fprintf(outfile,"================================= =\n");
fclose(outfile);
[\code]
I wonder if that is what I really have to do or if there is another short way of doing it, since with the first example on Xcode the address for the outfile is NULL.
It would be very helpful for me to know the short way, if any, since I work with many C programs (and with someone that uses Windows Visual Studio) and it is really annoying to remember the whole path all the time, or to change all the programs my colleage does so I can run them on my mac.
Thans a lot