cant close file descriptor 3 ???

szurilo szurilo at sch.bme.hu
Mon Oct 29 09:10:06 PDT 2007


I developed a program under Debian, wxWidgets 2.6.4. Code::Blocks unicode
nightly. (gcc 3.4.2)
Now i tried to compile and run this program under WinXp, wxWidgets 2.8.6,
Code::blocks unicode nightly. (mingw 3.4.2, gdb for mingw 6.3).
My program has the correct includes and libraries path as far as i know.
Compiling and linking went fine.
Altough the program starts but it drops a 'Test error' with the following
messages:
Cant close file descriptor 3 (error 0: the operation completed
successfully.)
The details of this error window shows another two messages:
Cant read file descriptor 3 (error 0: the operation completed successfully.)
Cant close file descriptor 3 (error 0: the operation completed
successfully.)

If i close the Test error window the program still running but it doesnt do
its job of course.
Now i tried to debug my program but gdb 6.3 doesnt even stop at any
breakpoints!!
The output of the debugger is the following:
Starting debugger: done
Registered new type: wxString
Registered new type: STL String
Registered new type: STL Vector
Setting breakpoints
Debugger name and version: GNU gdb 6.3
Child process PID: 2400
Program exited with code 037777777777.
Debugger finished with status 0
Strange, isnt it? but i think this anomaly belongs to somewhere else.

Now here is my code snippet:
void ScannerSettingsDialog::ReadDataFromScanSettingsFile(char* destination,
wxString filename)
{
    wxFile file;
	int i = 0;
	*destination = 0;

	if (!(file.Open(filename,wxFile::read)))
        return;

	while(file.Read(destination + i, sizeof(char)) == sizeof(char))
	{
		i++;
	}
	*(destination + i) = 0;

	file.Close();
}
I think the problem must be here somewhere, because if i comment these lines
the errors disappears.
The function simply open a file and read out everything into a buffer called
'destination'.
Anyway i call this function this way:
char* buf=new char[50];
    wxString wxFileName;
    wxFileName=_("ScanSettings.dat");
    wxFile settingsFile;
    if(!settingsFile.Access(wxFileName, wxFile::read ))
        {
            wxMessageBox(_("ScanSettings.dat file not found. Cannot load
settings."));
            return;
        }
    ReadDataFromScanSettingsFile(buf,wxFileName);

As i said it before these code fragment works fine under my Linux
distribution!
I hope someone can help me. Thx.

Szurilo
-- 
View this message in context: http://www.nabble.com/cant-close-file-descriptor-3------tf4712686.html#a13470801
Sent from the wxWidgets - Users mailing list archive at Nabble.com.





More information about the wx-users mailing list