gamecocks
February 24th, 2005, 03:02 PM
such as model = fopen("model_network.dat","r");
I don't know why. It work in the morning. thank you for your help.
I don't know why. It work in the morning. thank you for your help.
|
Click to See Complete Forum and Search --> : all fopen don't work right now. gamecocks February 24th, 2005, 03:02 PM such as model = fopen("model_network.dat","r"); I don't know why. It work in the morning. thank you for your help. Andreas Masur February 24th, 2005, 03:56 PM Welll...pointing out the obvious...it does not find the file? You are relying on the current working directory which might have be changed by the time you are trying to open the file. Where does the file resides? Anyway...the following FAQs might help: How to set the current working directory? (http://www.codeguru.com/forum/showthread.php?t=312469) How to get the current working directory? (http://www.codeguru.com/forum/showthread.php?t=312470) How to get the application directory? (http://www.codeguru.com/forum/showthread.php?t=312471) ovidiucucu February 25th, 2005, 05:02 AM Generally it's a good aproach to pass the full-path-and-file-name because as Andreas already said the current directory may change. Additionaly you can test if fopen returns NULL. If yes, you can see what's going wrong like in example below: FILE* model = fopen("model_network.dat","r"); if(NULL == model) { char* error = strerror(errno); } codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |