Reputation: 1487
I am required to run my compiled program using my account in university's HPCC center. My program should output the results in a text file, so I am using fopen
function:
FILE *fp = fopen("Users/Tiff/Documents/output.txt", "w+");
In my computer, I can simply specify the entire path but in HPCC I don't know my account's path on HPCC's main cluster. How do I make my program output the result in the same directory on my HPCC account without having to know the full path?
Upvotes: 3
Views: 8323
Reputation: 736
Specify the name of the .txt file, it will automatically output to the current working directory.
In your case: FILE *fp = fopen("output.txt", "w+");
Upvotes: 1
Reputation: 1276
You should be able to use the following code:
FILE *fp = fopen("output.txt", "w+");
The file "output.txt" would be in the current directory.
Upvotes: 4