Click here to Skip to main content
15,923,576 members
Home / Discussions / C#
   

C#

 
QuestionGeneate XML file from Excel Worksheet----Urgent Help me Pls Pin
winpoorni22-Feb-06 20:15
winpoorni22-Feb-06 20:15 
AnswerRe: Geneate XML file from Excel Worksheet----Urgent Help me Pls Pin
veeru_syd27-Feb-06 12:55
veeru_syd27-Feb-06 12:55 
QuestionHow to set DataGridViewButtonColumn 's Enabled Pin
renmudi22-Feb-06 20:05
renmudi22-Feb-06 20:05 
QuestionPrinting using WMI Pin
raheeli22-Feb-06 20:04
raheeli22-Feb-06 20:04 
QuestionAdd Icon to Menu Item Pin
Praveen_S22-Feb-06 20:04
Praveen_S22-Feb-06 20:04 
QuestionHow to create simple boolean property for usercontrol, so, that it shows in IDE property page? Pin
Oskars22-Feb-06 19:43
Oskars22-Feb-06 19:43 
AnswerRe: How to create simple boolean property for usercontrol, so, that it shows in IDE property page? Pin
Praveen Nayak23-Feb-06 19:49
Praveen Nayak23-Feb-06 19:49 
QuestionRedirecting Std Input, Output and Error Pin
Dribble22-Feb-06 19:34
Dribble22-Feb-06 19:34 
Hi,
I am a newbie to C# and Im trying to redirect standard input, output and error of a console program written in C (MS VC 6.0) to a textbox on a form. The code for the redirecting looks like this:

private System.IO.StreamWriter c_StreamInput = null;
private System.IO.StreamReader c_StreamOutput = null;
private Thread c_ThreadRead = null;
private Process c_Process = null;

private void ReadStdOutputThreadProc()
{
try
{
string str = c_StreamOutput.ReadLine();
while(str != null)
{
txtboxCNF.AppendText(str+"\r\n");
Thread.Sleep(100);
str = c_StreamOutput.ReadLine();
}
}
catch(Exception) {}
}

private void btnStart_Click(object sender, System.EventArgs e)
{
if(c_Process == null)
{
c_Process = new Process();
ProcessStartInfo psi = new ProcessStartInfo("console.exe");
psi.UseShellExecute = false;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = true;
c_Process.StartInfo = psi;
c_Process.Start();

c_StreamInput = c_Process.StandardInput;
c_StreamOutput = c_Process.StandardOutput;

c_StreamInput.AutoFlush = true;

c_ThreadRead = new Thread(new ThreadStart(ReadStdOutputThreadProc));
c_ThreadRead.Start();
}
}

private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (c_ThreadRead != null)
{
c_ThreadRead.Abort();
c_ThreadRead.Join();
}
if(c_Process != null && !c_Process.HasExited)
c_Process.Kill();
}

The console application that I am trying to run (console.exe) is a simple C program that prints a line text and then calls the getchar() function. The code is basically this:

#include "stdafx.h"
#include

int main(int argc, char* argv[])
{
printf ("Hello World !!\n");
int ch = getchar();
printf("Character = %s\n", ch);
return 0;
}

I have tried to run the C program without the getchar() function and it works. The problem arises when I use the getchar() function. I have tried getch() and gets() version without any success. I am not sure if I have to do anything special for showing output when using such functions.

Any help/pointers in this direction will be greately appreciated.

Thanks in advance.




Dribble
QuestionMySQL vs. SQL Server Pin
Expert Coming22-Feb-06 19:30
Expert Coming22-Feb-06 19:30 
AnswerRe: MySQL vs. SQL Server Pin
emran83422-Feb-06 19:40
emran83422-Feb-06 19:40 
GeneralRe: MySQL vs. SQL Server Pin
Expert Coming22-Feb-06 19:42
Expert Coming22-Feb-06 19:42 
GeneralRe: MySQL vs. SQL Server Pin
emran83422-Feb-06 19:50
emran83422-Feb-06 19:50 
QuestionHow to store images in dll? Pin
Oskars22-Feb-06 19:24
Oskars22-Feb-06 19:24 
AnswerRe: How to store images in dll? Pin
Alomgir Miah22-Feb-06 19:30
Alomgir Miah22-Feb-06 19:30 
GeneralRe: How to store images in dll? Pin
Oskars22-Feb-06 19:36
Oskars22-Feb-06 19:36 
QuestionPanel autoscrollposition hell! Pin
NewbieDude22-Feb-06 19:06
NewbieDude22-Feb-06 19:06 
QuestionMapping of Excel sheet into Access Table by using C# code Pin
vivekdeshpande22-Feb-06 18:46
vivekdeshpande22-Feb-06 18:46 
AnswerRe: Mapping of Excel sheet into Access Table by using C# code Pin
Acheive_it22-Feb-06 23:29
Acheive_it22-Feb-06 23:29 
AnswerRe: Mapping of Excel sheet into Access Table by using C# code Pin
Acheive_it23-Feb-06 18:01
Acheive_it23-Feb-06 18:01 
QuestionMethod Lock Pin
JacquesDP22-Feb-06 18:41
JacquesDP22-Feb-06 18:41 
AnswerRe: Method Lock Pin
emran83422-Feb-06 19:25
emran83422-Feb-06 19:25 
GeneralRe: Method Lock Pin
JacquesDP22-Feb-06 19:33
JacquesDP22-Feb-06 19:33 
GeneralRe: Method Lock Pin
emran83422-Feb-06 19:43
emran83422-Feb-06 19:43 
GeneralRe: Method Lock Pin
JacquesDP22-Feb-06 20:11
JacquesDP22-Feb-06 20:11 
GeneralRe: Method Lock Pin
J4amieC22-Feb-06 21:34
J4amieC22-Feb-06 21:34 

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.