Click here to Skip to main content
15,889,795 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to access environment variables? Pin
Member 227578520-Sep-05 10:24
Member 227578520-Sep-05 10:24 
AnswerRe: How to access environment variables? Pin
David Crow20-Sep-05 10:35
David Crow20-Sep-05 10:35 
GeneralRe: How to access environment variables? Pin
Member 227578520-Sep-05 10:39
Member 227578520-Sep-05 10:39 
GeneralRe: How to access environment variables? Pin
Graham Bradshaw20-Sep-05 12:22
Graham Bradshaw20-Sep-05 12:22 
Questionclosing main window, close IE window problem Pin
babyspidy20-Sep-05 9:59
babyspidy20-Sep-05 9:59 
AnswerRe: closing main window, close IE window problem Pin
Achim Klein20-Sep-05 21:17
Achim Klein20-Sep-05 21:17 
GeneralRe: closing main window, close IE window problem Pin
babyspidy20-Sep-05 21:31
babyspidy20-Sep-05 21:31 
Questioncrashes on close() Pin
bonosa20-Sep-05 9:57
bonosa20-Sep-05 9:57 
I'm using the same source files on windows and on linux

    /* Open  file */<br />
#ifdef WIN32<br />
    fd = open (*it, _O_RDONLY | _O_BINARY);<br />
#endif<br />
<br />
#ifdef __unix<br />
    fd = open (*it, O_RDONLY);<br />
<br />
#endif<br />
    if (fd == -1) {<br />
      return 1;<br />
    }<br />
<br />


Then I do stuff

and finally:
#ifdef WIN32<br />
	_close(fd);<br />
#endif<br />
<br />
#ifdef __unix<br />
	close(fd);<br />
#endif


Its fine on windows, crashes with an invalid pointer on linux at the close. I dont know what this means, but if instead of _close, I use close() on windows, it crashes on windows too.

How do I close my files on linux?
Thanks,
sb


-- modified at 15:58 Tuesday 20th September, 2005
AnswerRe: crashes on close() Pin
David Crow20-Sep-05 10:32
David Crow20-Sep-05 10:32 
GeneralRe: crashes on close() Pin
bonosa20-Sep-05 10:45
bonosa20-Sep-05 10:45 
GeneralRe: crashes on close() Pin
bonosa20-Sep-05 11:03
bonosa20-Sep-05 11:03 
GeneralRe: crashes on close() Pin
David Crow21-Sep-05 3:25
David Crow21-Sep-05 3:25 
QuestionChanging the BG color of a multiline edit box Pin
Mohammad A Gdeisat20-Sep-05 9:44
Mohammad A Gdeisat20-Sep-05 9:44 
AnswerRe: Changing the BG color of a multiline edit box Pin
Christopher Lloyd20-Sep-05 12:44
Christopher Lloyd20-Sep-05 12:44 
QuestionTMS InnerView 2.1 Pin
davemassey20-Sep-05 8:33
davemassey20-Sep-05 8:33 
AnswerRe: TMS InnerView 2.1 Pin
Alexander M.,20-Sep-05 8:35
Alexander M.,20-Sep-05 8:35 
QuestionRetrive previously selected index in a CListbox control when ON_LBN_SELCHANGE is fired Pin
Liu Shuai20-Sep-05 7:34
Liu Shuai20-Sep-05 7:34 
AnswerRe: Retrive previously selected index in a CListbox control when ON_LBN_SELCHANGE is fired Pin
Alexander M.,20-Sep-05 8:38
Alexander M.,20-Sep-05 8:38 
GeneralRe: Retrive previously selected index in a CListbox control when ON_LBN_SELCHANGE is fired Pin
Liu Shuai20-Sep-05 9:21
Liu Shuai20-Sep-05 9:21 
QuestionSlidder Display Pin
P.Sunitha Kiranmaye20-Sep-05 6:20
P.Sunitha Kiranmaye20-Sep-05 6:20 
AnswerRe: Slidder Display Pin
David Crow20-Sep-05 7:03
David Crow20-Sep-05 7:03 
AnswerRe: Slidder Display Pin
PJ Arends20-Sep-05 7:50
professionalPJ Arends20-Sep-05 7:50 
QuestionRunning a batch file Pin
Camron20-Sep-05 5:26
Camron20-Sep-05 5:26 
AnswerRe: Running a batch file Pin
David Crow20-Sep-05 5:37
David Crow20-Sep-05 5:37 
GeneralRe: Running a batch file Pin
Camron20-Sep-05 5:49
Camron20-Sep-05 5:49 

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.