By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,605 Members | 1,370 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,605 IT Pros & Developers. It's quick & easy.

fopen()

P: 1
hi.
how can I define a path for my files.
ex.



FILE *ofp;
char BrugerNr[5];

ofp = fopen(<<Folder>>\BrugerNr, "w");



Note that BrugerNr is a variable!
best regards
Thomas
Nov 16 '06 #1
Share this Question
Share on Google+
2 Replies


Banfa
Expert Mod 5K+
P: 8,916
FILE *ofp;
char BrugerNr[5];
char Path[200] = "<<Folder>>";
char FullPath[205];

strcpy( FullPath, Path);
strcpy( FullPath, BrugerNr);

ofp = fopen(FullPath, "w");
Nov 16 '06 #2

100+
P: 145
I think that second strcpy will need to be replaced by a strcat. -- Paul
Nov 17 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.