473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

about output redirection

hello!
I am currently writing my own script and need help on output redirection.as u know 'ls -al > myfile' would write the files in the current directory into the file called myfile.i know about opening a file and writing with fputc but have no idea about how to prevent the command from writing the output to terminal and get the output data to write to file..i hope i could tell my problem and someone could have an idea.
Nov 11 '07 #1
5 1633
numberwhun
3,509 Expert Mod 2GB
hello!
I am currently writing my own script and need help on output redirection.as u know 'ls -al > myfile' would write the files in the current directory into the file called myfile.i know about opening a file and writing with fputc but have no idea about how to prevent the command from writing the output to terminal and get the output data to write to file..i hope i could tell my problem and someone could have an idea.
First, I have deleted your duplicate post. Please do not double post your questions.

Second, I am not sure that I understand. Are you saying that you want the default output for your Terminal to be a file instead of the screen? If that is the case, how will you know what you are doing? If that is NOT what you want, then you will really have to better explain your question as it is rather confusing.

Regards,

Jeff
Nov 11 '07 #2
sorry about the duplicate post i tried to delete it but couldnt figure out how to do that.
i am trying to build a shell for my hw so if the user enters such a command "ls -al > myfile.txt" my shell should write the "ls -al" output into the myfile.txt instead writing to shell page..(just the same what bash shell does)
Nov 11 '07 #3
prevent the command from writing the output to terminal .
i am talking about the output of "ls -al "here..not all of the outputs we get from the shell
Nov 11 '07 #4
pbmods
5,821 Expert 4TB
Heya, zehrhand.

`ls -al > myfile.txt` doesn't do what you're expecting it to do?
Nov 11 '07 #5
yea but i want to write a function which does that job.i dont want to use built-in functions..if my shell uses system functions for all jobs,then whats the point of writing a shell?
Nov 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bill Cohagan | last post by:
I'm writing a console app (in C#) and I want to be able to redirect the standard input/output streams when it's run at a command prompt. IOW I want to support the "<" and ">" redirection syntax....
1
by: Michael Shestero | last post by:
Hello. General description of my knotty problem: I have a code (a function f) on standart C++ that perform some smart action. This code works as console application getting user input from...
3
by: Liren Zhao | last post by:
I use some "Console.WriteLine(some strings here)" to display some debug information in my winform program. How can I get the information in my programe or same them in a text file ?
3
by: ES Kim | last post by:
Hi, I am using VC++ .NET 7.0. I'd like to debug my console program, using redirection of input/output for convenience. Help menu tells me it's possible to specify a file name as a command-line...
1
by: Karuna | last post by:
Hi, I am new to MySQL. I want to create a script file which will include a number of commands and execute it, just like we do in Oracle. Can any one tell me how to do it? Suppose I want to create...
1
by: btysgtmajor | last post by:
Hi all, I've searched high and low on this group and elsewhere and can't really seem to find an answer to this question. I'm running PHP4 on a Debian box with Apache. I'm trying to run the...
4
by: Barry | last post by:
Hi, guys Basiclly, it is automated testing system. There is a main python script that handles the testing campagin. This main script will call another script that will in turn runs a few...
2
by: prajil | last post by:
Hi, Could anyone point how can i override output redirection using perl. i.e. command > file 2>&1 will redirect both output and error of command to file I need to print a message to...
1
by: laredotornado | last post by:
Hi, I'm using PHP 5. Assuming there are no errors, how do I get the output of an exec call? I'm trying $cmd = 'strings < ' . escapeshellarg($file) . ' | sed - n \'s|.*/Count...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.