Click here to Skip to main content
15,936,802 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Is there any way to execute XQuery through MFC or C++ (This question Previously left with no answer) Pin
David Crow30-Dec-09 9:40
David Crow30-Dec-09 9:40 
JokeRe: Is there any way to execute XQuery through MFC or C++ (This question Previously left with no answer) Pin
enhzflep30-Dec-09 12:00
enhzflep30-Dec-09 12:00 
GeneralRe: Is there any way to execute XQuery through MFC or C++ (This question Previously left with no answer) Pin
Tim Craig30-Dec-09 19:59
Tim Craig30-Dec-09 19:59 
AnswerRe: Is there any way to execute XQuery through MFC or C++ (This question Previously left with no answer) Pin
A&Ms31-Dec-09 0:20
A&Ms31-Dec-09 0:20 
QuestionPipe & Fork code - need help Pin
SummerBulb30-Dec-09 7:24
SummerBulb30-Dec-09 7:24 
AnswerRe: Pipe & Fork code - need help Pin
CPallini30-Dec-09 8:02
mveCPallini30-Dec-09 8:02 
QuestionRe: Pipe & Fork code - need help Pin
SummerBulb30-Dec-09 8:14
SummerBulb30-Dec-09 8:14 
AnswerRe: Pipe & Fork code - need help Pin
CPallini30-Dec-09 9:57
mveCPallini30-Dec-09 9:57 
You may have, at least, two problems:
  • read return value is -1.
  • read return value is positive, but less than 50.


When read returns -1, you've to check errno to understand what happened (in any case you must NOT write (garbage) values to the output file.

When read returns a positive value less than 50, you should copy just the read bytes to the output file.

For instance
while ( ! finished )
{
  ssize nread = read(fd[0],buf,50);
  if ( nread == -1 )
  {
    // handle error
  }
  else if (nread > 0)
  {
    printf("Read %d characters\n", nread);
    buf[nread]='\0';
    printf(buf);
    write(fileOpen, buf, nread);
  }
}


where finished is a termination condition (timeout?) that you possibly know better than me.

If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.

This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke

[My articles]

QuestionRe: Pipe & Fork code - need help Pin
SummerBulb30-Dec-09 19:44
SummerBulb30-Dec-09 19:44 
AnswerRe: Pipe & Fork code - need help Pin
CPallini30-Dec-09 22:02
mveCPallini30-Dec-09 22:02 
GeneralRe: Pipe & Fork code - need help Pin
SummerBulb31-Dec-09 23:33
SummerBulb31-Dec-09 23:33 
GeneralYou are welcome Pin
CPallini1-Jan-10 7:15
mveCPallini1-Jan-10 7:15 
AnswerRe: Pipe & Fork code - need help Pin
markkuk30-Dec-09 13:02
markkuk30-Dec-09 13:02 
GeneralRe: Pipe & Fork code - need help Pin
SummerBulb30-Dec-09 19:39
SummerBulb30-Dec-09 19:39 
QuestionWhere can I find a forum about windows device driver development with WinDDK? Pin
sashoalm29-Dec-09 23:20
sashoalm29-Dec-09 23:20 
AnswerRe: Where can I find a forum about windows device driver development with WinDDK? Pin
David Crow30-Dec-09 3:02
David Crow30-Dec-09 3:02 
AnswerRe: Where can I find a forum about windows device driver development with WinDDK? Pin
Richard MacCutchan30-Dec-09 3:16
mveRichard MacCutchan30-Dec-09 3:16 
QuestionWindows Service Pin
S p k 52129-Dec-09 23:09
S p k 52129-Dec-09 23:09 
AnswerRe: Windows Service Pin
Madhu Nair29-Dec-09 23:15
Madhu Nair29-Dec-09 23:15 
GeneralRe: Windows Service Pin
S p k 52130-Dec-09 16:42
S p k 52130-Dec-09 16:42 
QuestionUsing delegates in vc++ Pin
Anu_Bala29-Dec-09 21:49
Anu_Bala29-Dec-09 21:49 
AnswerRe: Using delegates in vc++ Pin
Maxwell Chen29-Dec-09 22:01
Maxwell Chen29-Dec-09 22:01 
GeneralRe: Using delegates in vc++ Pin
Anu_Bala29-Dec-09 22:04
Anu_Bala29-Dec-09 22:04 
GeneralRe: Using delegates in vc++ Pin
N a v a n e e t h30-Dec-09 6:47
N a v a n e e t h30-Dec-09 6:47 
GeneralRe: Using delegates in vc++ Pin
Maxwell Chen30-Dec-09 14:27
Maxwell Chen30-Dec-09 14:27 

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.