Thread: @ explanation pls

  1. #1
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271

    @ explanation pls

    can someone explain what the @ symbol does in the following:
    Code:
    [DllImport(@"setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)]
    I've been seeing this a few times in other examples codes on completely different topics but always added beofre strings.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Telling the system what DLL the function is in?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    It's a verbatim string, in this case, the same as had someone said "setupapi.dll" - There are no escapes inside a verbatim string, except for double quotes (which is "". not \"). My guess is that MS is finally tired of typing: "\\\\SERVER\\share\\path\\file" - @"\\SERVER\share\path\file"
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  4. #4
    Registered User
    Join Date
    Aug 2008
    Posts
    188
    Quote Originally Posted by Cactus_Hugger View Post
    It's a verbatim string, in this case, the same as had someone said "setupapi.dll" - There are no escapes inside a verbatim string, except for double quotes (which is "". not \"). My guess is that MS is finally tired of typing: "\\\\SERVER\\share\\path\\file" - @"\\SERVER\share\path\file"
    i find it useful for regex as well.

  5. #5
    Tha 1 Sick RAT
    Join Date
    Dec 2003
    Posts
    271
    Quote Originally Posted by matsp View Post
    Telling the system what DLL the function is in?
    Mats
    but p/Invoke works fine without that symbol.

    Thanks everyone else.
    A hundred Elephants can knock down the walls of a fortress... One diseased rat can kill everyone inside

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linked Lists
    By Bleu_Cheese in forum C++ Programming
    Replies: 13
    Last Post: 12-21-2007, 09:17 PM
  2. Basic port scanner code .. pls help ???
    By intruder in forum C Programming
    Replies: 18
    Last Post: 03-13-2003, 08:47 AM
  3. help me pls..... :(
    By mocha_frap024 in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2002, 10:46 AM
  4. C programming - pls pls help me
    By sally arnold in forum C Programming
    Replies: 10
    Last Post: 01-16-2002, 04:55 AM
  5. Pls Help Me In This Question!!!
    By Joanna in forum Windows Programming
    Replies: 1
    Last Post: 10-20-2001, 02:05 PM