Thread: Cacls syntax in C.

  1. #1
    Registered User MRIce's Avatar
    Join Date
    Jun 2012
    Posts
    6

    Cacls syntax in C.

    Hey guys,

    I'm writing a C program that uses the cacls function a command line to change permissions on folders. I don't know how to do this in C though.
    Anyone know how to do this? The post I found here addressing the same question had a broken link:
    cacls
    I've tried a few things, but I am getting errors.

    Thank you.

  2. #2
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    The original link points here, though it doesn't tell you how to use cacls. It tells you, amongst other things, how to do what cacls does so you don't need it.

  3. #3
    Registered User MRIce's Avatar
    Join Date
    Jun 2012
    Posts
    6
    Is there anyway to directly type into a command line from C?
    Like the old post, I don't know how to use the systems function with cacls.

  4. #4
    Registered User
    Join Date
    Mar 2011
    Posts
    546
    if you can type the command you want at a command line, then you can issue the same command from C using
    Code:
    system("<whatever you typed>");

  5. #5
    Registered User MRIce's Avatar
    Join Date
    Jun 2012
    Posts
    6
    But what if I need quotation marks in the command line? For example:
    Code:
    system( "cacls c:/users/dummy/desktop/testfolder /E /G "person who puts spaces in name":F" ) ;
    It actually unquotes the entire name from the command.

  6. #6
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    Quote Originally Posted by MRIce View Post
    But what if I need quotation marks in the command line? For example:
    Code:
    system( "cacls c:/users/dummy/desktop/testfolder /E /G "person who puts spaces in name":F" ) ;
    It actually unquotes the entire name from the command.
    You need a backslash \ before the inner quotes.
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

  7. #7
    Registered User MRIce's Avatar
    Join Date
    Jun 2012
    Posts
    6
    Thank you so much.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Array Syntax Versus Pointer Syntax
    By LyTning94 in forum C++ Programming
    Replies: 6
    Last Post: 12-06-2011, 10:56 AM
  2. syntax?
    By arc_angel14 in forum C++ Programming
    Replies: 4
    Last Post: 09-05-2010, 02:51 PM
  3. syntax help!!!!!!
    By 12oclock in forum C Programming
    Replies: 4
    Last Post: 02-22-2008, 05:56 PM
  4. syntax ?
    By bean66 in forum C Programming
    Replies: 3
    Last Post: 08-22-2007, 09:44 PM
  5. cacls
    By cgod in forum C++ Programming
    Replies: 1
    Last Post: 08-09-2005, 04:50 AM

Tags for this Thread