Jump to content
  • Advertisement
Sign in to follow this  

ERROR_NO_SYSTEM_RESOURCES ???

This topic is 4883 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having a problem with an ap. It writes out to a file. It runs fine for a while. Then it stops working. At the point it calls CreateFile, the func returns ERROR_NO_SYSTEM_RESOURCES. What causes this error (alot to ask; there's probably a million)? The app is constantly opening and closing the same file to write to it. However, the handle is being closed. The app's memory usage does not look too bad. Nothing extreme. Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
You'll probably have to post some source code if you want people to give you any useful help as at the moment yeah I think it could be anything. Also what language your using could be helpful:)

Share this post


Link to post
Share on other sites

char msg[256];
while(app_running)
{
if((hFile == NULL) && (MsgQueueCount > 0))
{

hFile = CreatFile(...., OPEN_ALWAYS);

PopMsgFromQueue(&msg);
WriteFile(hFile, msg..);


CloseHandle(hFile);

hFile = NULL;
}
}

Share this post


Link to post
Share on other sites
OTOH, re-opening and closing the file every iteration of the main game loop may not be the smartest thing to do, even if it should work in theory :/

Share this post


Link to post
Share on other sites
I wanted a user to be able to open the file via notepad while app was still running and writing to file. I tried to call CreateFile with different flags but couldn't get it to work. Notepad would give error message saying another app had access to file. Am I missing something? I agree it does not seem too good to constantly open and close.

Share this post


Link to post
Share on other sites
I think you need to set dwShareMode to FILE_SHARE_READ in CreateFile so that you can open it in notepad while your app has it open.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!