Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a File in the same Directory and the Application 2

Status
Not open for further replies.

Watts

Programmer
Jan 18, 2001
80
US
How can I create a file, append an array of characters to this file, and place the completed file in the same directory as the application?

Any code examples would be great!
 
You asked many questions in your post.

I'm not exactly sure of the requirements of your program, but this is the basic steps of how it could be done.

Changing to your program directory:
- GetModuleFileName to retrieve program path
- C string functions to cut the path down to the bottommost directory
- _chdir to change program directory

Opening a file
use fopen

Writing an array to a file
fwrite

Closing a file
fclose
 
Hey the GetModuleFileName was what I was looking for. I could have probably figured out how to create and write to the file myself by looking through MSDN. Thanks a bunch...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top