Click here to Skip to main content
15,893,594 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: File Opening Failed Pin
«_Superman_»30-Jun-10 18:54
professional«_Superman_»30-Jun-10 18:54 
AnswerRe: File Opening Failed Pin
T.RATHA KRISHNAN30-Jun-10 19:00
T.RATHA KRISHNAN30-Jun-10 19:00 
GeneralRe: File Opening Failed Pin
KingsGambit30-Jun-10 19:20
KingsGambit30-Jun-10 19:20 
GeneralRe: File Opening Failed Pin
T.RATHA KRISHNAN30-Jun-10 19:26
T.RATHA KRISHNAN30-Jun-10 19:26 
GeneralRe: File Opening Failed Pin
KingsGambit30-Jun-10 19:49
KingsGambit30-Jun-10 19:49 
GeneralRe: File Opening Failed Pin
T.RATHA KRISHNAN30-Jun-10 20:00
T.RATHA KRISHNAN30-Jun-10 20:00 
GeneralRe: File Opening Failed Pin
Richard MacCutchan30-Jun-10 21:38
mveRichard MacCutchan30-Jun-10 21:38 
AnswerRe: File Opening Failed Pin
Aescleal30-Jun-10 21:16
Aescleal30-Jun-10 21:16 
A couple of things to consider...

- why are you calling open()? It's more common to see something like:

std::ifstream input( "c://test.txt" );
if( input )
{
    std::string text;
    std::getline( input, text );

    // Do something with text
}


- Don't bother manually closing the file - it's completely pointless

- Are you sure you want to read one character from a file then try and write 150? Especially into something that's a constant block of memory.

None of these things explain why the file isn't being opened. The Error number you're getting seems to imply the file already exists which is an error I'd expect from trying to open an ofstream. Are you doing the GetLastError immediately after calling myfile.open()?

Cheers,

Ash
AnswerRe: File Opening Failed Pin
David Crow1-Jul-10 4:22
David Crow1-Jul-10 4:22 
QuestionFILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
auriga1930-Jun-10 12:18
auriga1930-Jun-10 12:18 
AnswerRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
«_Superman_»30-Jun-10 18:48
professional«_Superman_»30-Jun-10 18:48 
GeneralRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
auriga191-Jul-10 5:59
auriga191-Jul-10 5:59 
QuestionRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
David Crow1-Jul-10 8:15
David Crow1-Jul-10 8:15 
AnswerRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
auriga191-Jul-10 9:22
auriga191-Jul-10 9:22 
QuestionRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
David Crow1-Jul-10 10:00
David Crow1-Jul-10 10:00 
AnswerRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
auriga191-Jul-10 10:02
auriga191-Jul-10 10:02 
QuestionRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
David Crow1-Jul-10 10:23
David Crow1-Jul-10 10:23 
AnswerRe: FILE_NOTIFY_CHANGE_SIZE and FindFirstChangeNotification behavior in W7 and XP Pin
auriga191-Jul-10 10:41
auriga191-Jul-10 10:41 
Questionabout Hook Pin
rockago30-Jun-10 9:48
rockago30-Jun-10 9:48 
AnswerRe: about Hook Pin
Adam Roderick J30-Jun-10 17:55
Adam Roderick J30-Jun-10 17:55 
GeneralRe: about Hook Pin
rockago30-Jun-10 18:36
rockago30-Jun-10 18:36 
QuestionCMDIChildWnd changing size unexpectedly Pin
genush30-Jun-10 6:45
genush30-Jun-10 6:45 
AnswerRe: CMDIChildWnd changing size unexpectedly Pin
Niklas L30-Jun-10 9:31
Niklas L30-Jun-10 9:31 
GeneralRe: CMDIChildWnd changing size unexpectedly Pin
genush2-Jul-10 11:29
genush2-Jul-10 11:29 
QuestionConnect to http server / check if file exists [modified] Pin
ALLERSLIT30-Jun-10 4:40
ALLERSLIT30-Jun-10 4:40 

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.