Click here to Skip to main content
15,908,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
QuestionWriting a non-Windows program Pin
Anthony Appleyard19-Jan-13 1:23
Anthony Appleyard19-Jan-13 1:23 
AnswerRe: Writing a non-Windows program Pin
Richard MacCutchan19-Jan-13 1:35
mveRichard MacCutchan19-Jan-13 1:35 
QuestionHow to get Visual C++ to use the char* forms of standard functions? Pin
Anthony Appleyard19-Jan-13 1:15
Anthony Appleyard19-Jan-13 1:15 
AnswerRe: How to get Visual C++ to use the char* forms of standard functions? Pin
SajeeshCheviry19-Jan-13 1:29
SajeeshCheviry19-Jan-13 1:29 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? Pin
Richard MacCutchan19-Jan-13 1:34
mveRichard MacCutchan19-Jan-13 1:34 
AnswerRe: How to get Visual C++ to use the char* forms of standard functions? Pin
Richard MacCutchan19-Jan-13 1:33
mveRichard MacCutchan19-Jan-13 1:33 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? Pin
SajeeshCheviry19-Jan-13 1:37
SajeeshCheviry19-Jan-13 1:37 
GeneralRe: How to get Visual C++ to use the char* forms of standard functions? Pin
Anthony Appleyard19-Jan-13 12:06
Anthony Appleyard19-Jan-13 12:06 

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.