Click here to Skip to main content
15,891,424 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: The 'rename' function gives errno == -1 Pin
Anthony Appleyard20-Jan-13 4:32
Anthony Appleyard20-Jan-13 4:32 
GeneralRe: The 'rename' function gives errno == -1 Pin
Richard MacCutchan20-Jan-13 4:37
mveRichard MacCutchan20-Jan-13 4:37 
GeneralRe: The 'rename' function gives errno == -1 Pin
Anthony Appleyard20-Jan-13 5:02
Anthony Appleyard20-Jan-13 5:02 
GeneralRe: The 'rename' function gives errno == -1 Pin
Richard MacCutchan20-Jan-13 5:04
mveRichard MacCutchan20-Jan-13 5:04 
GeneralRe: The 'rename' function gives errno == -1 Pin
Anthony Appleyard20-Jan-13 5:11
Anthony Appleyard20-Jan-13 5:11 
GeneralRe: The 'rename' function gives errno == -1 Pin
Richard MacCutchan20-Jan-13 5:33
mveRichard MacCutchan20-Jan-13 5:33 
GeneralRe: The 'rename' function gives errno == -1 Pin
Anthony Appleyard20-Jan-13 5:57
Anthony Appleyard20-Jan-13 5:57 
GeneralRe: The 'rename' function gives errno == -1 Pin
Richard MacCutchan20-Jan-13 6:20
mveRichard MacCutchan20-Jan-13 6:20 
GeneralRe: The 'rename' function gives errno == -1 Pin
Anthony Appleyard20-Jan-13 11:03
Anthony Appleyard20-Jan-13 11:03 
GeneralRe: The 'rename' function gives errno == -1 Pin
Richard MacCutchan20-Jan-13 21:52
mveRichard MacCutchan20-Jan-13 21:52 
GeneralRe: The 'rename' function gives errno == -1 Pin
Anthony Appleyard20-Jan-13 22:11
Anthony Appleyard20-Jan-13 22:11 
GeneralRe: The 'rename' function gives errno == -1 Pin
Richard MacCutchan20-Jan-13 23:00
mveRichard MacCutchan20-Jan-13 23:00 
QuestionRe: The 'rename' function gives errno == -1 Pin
David Crow20-Jan-13 15:17
David Crow20-Jan-13 15:17 
AnswerRe: The 'rename' function gives errno == -1 Pin
Anthony Appleyard20-Jan-13 18:15
Anthony Appleyard20-Jan-13 18:15 
GeneralRe: The 'rename' function gives errno == -1 Pin
Richard MacCutchan20-Jan-13 4:49
mveRichard MacCutchan20-Jan-13 4:49 
AnswerRe: The 'rename' function gives errno == -1 Pin
jschell20-Jan-13 6:13
jschell20-Jan-13 6:13 
Recapping scattered comments.

After EACH method call IMMEDIATELY check the return value.
if the return value is not zero then IMMEDIATELY call errno. Do NOT make any other API calls before calling errno.

So you code should look like the following (with the included suggestion of strerror


int ret = rename(...);
if (ret != 0)
{   
   // Do NOT put other API calls here!
   int errNum = errno;
   // At this point you can make other API calls.
   printf("Failed to rename %s", strerror(errNum));
}

GeneralBANZAI :: bug found Pin
Anthony Appleyard20-Jan-13 23:50
Anthony Appleyard20-Jan-13 23:50 
QuestionIs there a way to trace an mpi message through a topology? Pin
Cioroiu Adrian-Nicu19-Jan-13 6:39
Cioroiu Adrian-Nicu19-Jan-13 6:39 
AnswerRe: Is there a way to trace an mpi message through a topology? Pin
Richard MacCutchan19-Jan-13 21:32
mveRichard MacCutchan19-Jan-13 21:32 
QuestionSOLVED Cannot access #include files – “permission denied” Pin
Vaclav_19-Jan-13 4:38
Vaclav_19-Jan-13 4:38 
AnswerRe: Cannot access #include files – “permission denied” Pin
Richard MacCutchan19-Jan-13 5:23
mveRichard MacCutchan19-Jan-13 5:23 
GeneralRe: Cannot access #include files – “permission denied” Pin
Vaclav_19-Jan-13 7:09
Vaclav_19-Jan-13 7:09 
GeneralRe: Cannot access #include files – “permission denied” Pin
Richard MacCutchan19-Jan-13 7:11
mveRichard MacCutchan19-Jan-13 7:11 
GeneralRe: Cannot access #include files – “permission denied” Pin
Vaclav_19-Jan-13 12:02
Vaclav_19-Jan-13 12:02 
GeneralRe: Cannot access #include files – “permission denied” Pin
Richard MacCutchan19-Jan-13 21:26
mveRichard MacCutchan19-Jan-13 21:26 

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.