How to pass hidden input to another program in C#

I have been having trouble passing input programmatically to the system net user program using C#. I am trying to activate and set a password for a certain user account. By my investigations, it seems like the process finishes before anything can be ...
more »

2017-07-15 06:07 (1) Answers

Why can't Java IO implement async reading?

In Java IO, we use Stream and Reader while in NIO we use Channel, Selector. They both do the same thing, but the structure is totally different. So why they don't write a new Stream like "AsyncStream" or a Reader like "AsyncReader" to implement wha...
more »

2017-07-13 08:07 (0) Answers

"&>" and "<&" token questions

I'm a little confused about the <& and >& tokens and I've included an example with my question. On the bottom of my example, couldn't I just use <3 and >4 as arguments to cat? I know you can't because I've tried it but I just don't unde...
more »

2017-05-31 00:05 (1) Answers

C : Best way to go to a known line of a file

I have a file in which I'd like to iterate without processing in any sort the current line. What I am looking for is the best way to go to a determined line of a text file. For example, storing the current line into a variable seems useless until I g...
more »

2017-05-29 16:05 (4) Answers

Storing element in string

Question: In my code, what ever I enter for n, compiler allows me to input and output only half of it. Why? #include<stdio.h> #include<stdlib.h> int main() { int n; scanf("%d\n",&n); char *c= (char*)malloc((n+1)*...
more »

2017-05-20 11:05 (2) Answers

Intentionally cause a read/write timeout?

I'm trying to test some file io and I was wondering if there's a way to emulate the following situation: I have a block-storage device that is constantly being read/written from, but I want to notify the users of the proper error when they are tryin...
more »

2017-05-18 04:05 (1) Answers

Java searching file

I have 2 string variables: "givenAccnt" is the input string obtained from user "accntToken" is a substring (first string) of a line of text If givenAccnt equals accntToken, I want to return the line of text matched by accntToken. Furthermore, the...
more »

2017-04-25 05:04 (1) Answers

Java exec method, how to handle streams correctly

What is the proper way to produce and consume the streams (IO) of external process from Java? As far as I know, java end input streams (process output) should be consumed in threads parallel to producing the process input due the possibly limited buf...
more »

2017-03-13 09:03 (2) Answers

printf formatting equivalent in cpp's cout

I am currently a student of Computer Science, and today I received an extra-ordinary assignment, which should be written under C++. I was learning full C until today. This is more like a blind assignment. In C, I usually use this: printf("\n\n\t%-3...
more »

2017-03-08 14:03 (2) Answers

Ruby not creating file

I'm trying to create and write to a new file using @logFile ="C:\Users\---\Desktop\mylog.log", "w+") And nothing happens. My program uses @logFile.write ("Hello") @logFile.flush And this line seems to be running ok (no crashes ...
more »

2017-01-19 13:01 (2) Answers

Java - text to array to text

I'm looking for the best way to read integers+strings from a small text file, save them in an array, add a few new integers+strings, sort them by integers and then write highest few in the same file. (sth like highscores) Example: sth.txt: 5 aa 4 ...
more »

2017-01-17 20:01 (3) Answers

Measuring peak disk use of a process

I am trying to benchmark a tool I'm developing in terms of time, memory, and disk use. I know /usr/bin/time gives me basically what I want for the first two, but for disk use I came to the conclusion I would have to roll my own bash script that perio...
more »

2017-01-08 13:01 (2) Answers

Command output mangled on redirection

Given a directory with a few million files in it we want to extract some data from those files. find /dir/ -type f | awk -F"|" '$2 ~ /string/{ print $3"|"$7 }' > the_good_stuff.txt That will never scale so we introduce xargs. find /dir/ -type f...
more »

2016-12-28 23:12 (2) Answers

readChar from stdin

I would like to read in one character at a time and convert it to a string command to execute once a space is entered. I tried con <- file("stdin") open(con, blocking=TRUE) while(q!=" "){ #q=scan("",what="", nmax=1) q=readChar(con,1) cmd[...
more »

2016-12-18 08:12 (1) Answers