# define - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


# define

johnjitujohnjitu Posts: 23Member
can i define paths


  • LundinLundin Posts: 3,711Member
    Sure, go ahead.

    What do you mean by "path"? An access path to a directory or file? Those are just strings, so yes you can #define those, but a const char array is cleaner.
  • johnjitujohnjitu Posts: 23Member
    #define PATH C:windows

    Is this code is correct ?
  • VampireFEVampireFE Posts: 36Member
    Almost :) 2 problems with it:

    1. You'll want to put the path in "" since it's a text string.
    2. Since is an escape symbol, you need to put 2 of those if you want one backslash.

    Like this: [code]#define PATH "C:\windows\notepad.exe"[/code]
  • johnjitujohnjitu Posts: 23Member
    Thanks very much .
Sign In or Register to comment.