Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
AnswerRe: Cannot Resolve Path Error Pin
PIEBALDconsult15-Mar-12 17:40
mvePIEBALDconsult15-Mar-12 17:40 
GeneralRe: Cannot Resolve Path Error Pin
ProEnggSoft16-Mar-12 14:44
ProEnggSoft16-Mar-12 14:44 
AnswerRe: Cannot Resolve Path Error Pin
BobJanova15-Mar-12 23:07
BobJanova15-Mar-12 23:07 
GeneralRe: Cannot Resolve Path Error Pin
Pete O'Hanlon15-Mar-12 23:29
mvePete O'Hanlon15-Mar-12 23:29 
GeneralRe: Cannot Resolve Path Error Pin
BobJanova16-Mar-12 0:57
BobJanova16-Mar-12 0:57 
GeneralRe: Cannot Resolve Path Error Pin
Pete O'Hanlon16-Mar-12 1:06
mvePete O'Hanlon16-Mar-12 1:06 
AnswerRe: Cannot Resolve Path Error Pin
V.16-Mar-12 2:01
professionalV.16-Mar-12 2:01 
AnswerRe: Cannot Resolve Path Error Pin
Luc Pattyn16-Mar-12 4:17
sitebuilderLuc Pattyn16-Mar-12 4:17 
computerpublic wrote:
static void Main(string[] args)
string tempPath = Path.GetTempFileName();
string tempPath2 = Path.GetTempFileName();
if (File.Exists(tempPath))
   {
        byte[] data = File.ReadAllBytes("c:\tempPath");


Oh my.

1.
As Path.GetTempFileName() tries to provide you with a randomly chosen file name in order NOT to clash with existing files, how on earth do you expect File.Exists() to ever return true?

2.
Code should be put inside PRE tags, to preserve formatting and improve readability.

3.
And if there is some code sitting in between both method calls, you really should have indicated so.

4.
There is absolutely no relation between a variable called tempPath, and a file path with the value @"C:\tempPath".


Did you skip your morning coffee?

Confused | :confused:
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: Cannot Resolve Path Error Pin
computerpublic16-Mar-12 11:46
computerpublic16-Mar-12 11:46 
GeneralRe: Cannot Resolve Path Error Pin
Richard Andrew x6416-Mar-12 13:11
professionalRichard Andrew x6416-Mar-12 13:11 
GeneralRe: Cannot Resolve Path Error Pin
ProEnggSoft16-Mar-12 14:50
ProEnggSoft16-Mar-12 14:50 
Questioncrone file Pin
altafmohd15-Mar-12 8:39
altafmohd15-Mar-12 8:39 
AnswerRe: crone file Pin
Dave Kreskowiak15-Mar-12 9:19
mveDave Kreskowiak15-Mar-12 9:19 
JokeRe: crone file Pin
Not Active15-Mar-12 9:44
mentorNot Active15-Mar-12 9:44 
GeneralRe: crone file Pin
altafmohd16-Mar-12 2:10
altafmohd16-Mar-12 2:10 
GeneralRe: crone file Pin
altafmohd16-Mar-12 2:11
altafmohd16-Mar-12 2:11 
AnswerRe: crone file Pin
Sebastian T Xavier15-Mar-12 19:49
Sebastian T Xavier15-Mar-12 19:49 
GeneralRe: crone file Pin
altafmohd16-Mar-12 2:07
altafmohd16-Mar-12 2:07 
QuestionCouldn't able to access functions in a web service reference Pin
NarVish15-Mar-12 0:58
NarVish15-Mar-12 0:58 
AnswerRe: Couldn't able to access functions in a web service reference Pin
dan!sh 15-Mar-12 1:30
professional dan!sh 15-Mar-12 1:30 
GeneralRe: Couldn't able to access functions in a web service reference Pin
NarVish15-Mar-12 1:43
NarVish15-Mar-12 1:43 
GeneralRe: Couldn't able to access functions in a web service reference Pin
dan!sh 15-Mar-12 1:44
professional dan!sh 15-Mar-12 1:44 
GeneralRe: Couldn't able to access functions in a web service reference Pin
NarVish15-Mar-12 2:13
NarVish15-Mar-12 2:13 
GeneralRe: Couldn't able to access functions in a web service reference Pin
NarVish15-Mar-12 2:55
NarVish15-Mar-12 2:55 
QuestionXNA framework Accelerometer values Pin
DerecL14-Mar-12 22:59
DerecL14-Mar-12 22:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.