Thread: Another Embarassingly Easy Question

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    13

    Another Embarassingly Easy Question

    Hi..im REALLY new to programming and I have a question. I can't figure out how to make a folder in C. For example, id like to create a folder in C:\program files called "blah" or something but I dont know how. Thanks.

    Oh by the way I looked for quite a bit on Google but I couldnt find anything. (Dont think i just run to this board with every little question lol )

  2. #2
    Registered User OnionKnight's Avatar
    Join Date
    Jan 2005
    Posts
    555
    You can use CreateDirectory, a Windows API function.
    http://msdn.microsoft.com/library/de...edirectory.asp

    I have never really used it, but I'd imagine that something like this would work:
    Code:
    #include <stdio.h> //For NULL definition.. I think this is necessary... or is it? Also puts().
    #include <windows.h>
    
    int main ()
    {
    	if (CreateDirectory("C:\\Program Files\\blah", NULL) != TRUE)
    		puts("Oh no an error :(");
    
    	return 0;
    }
    [edit] It works but that link should be replaced with
    http://msdn.microsoft.com/library/de...edirectory.asp
    Last edited by OnionKnight; 02-11-2006 at 02:55 PM.

  3. #3
    Registered User
    Join Date
    Nov 2005
    Posts
    13
    thanks a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. easy Vector contructor question
    By noodle24 in forum C++ Programming
    Replies: 5
    Last Post: 04-21-2006, 07:43 PM
  2. This is hopefully an extremely easy question...
    By rachaelvictoria in forum C Programming
    Replies: 2
    Last Post: 11-07-2005, 01:36 AM
  3. 4 easy question
    By Zeratulsdomain in forum C++ Programming
    Replies: 2
    Last Post: 10-15-2005, 10:43 PM
  4. Quick Easy Question
    By St0rmTroop3er in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 02-24-2004, 01:08 AM
  5. Easy Question
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 08-12-2002, 12:19 PM