Dynamic array of pointers from user input

I need some help regarding dynamic allocation of arrays of pointers in C. I am trying to create a program that reads a sentence of words from user input, and stores the words in character array strings. I then want to save the pointers char *word to ...
more »

2017-10-07 21:10 (2) Answers

Removing file using name contains in Ruby

I have written the below code to keep a file that matches the passed in name and removes the rest of the files in the folder. def removeFiles2(path, namePart) aft_logger=AFTLogger.new Dir[path+'/*'].each do |fname| break if !(fname.include?...
more »

2017-09-29 10:09 (2) Answers

File I/O performance is too good to be true?

I ran a simple file I/O performance test. I wrote 1GB data to a file and measure the time elapsed. The result shows the write time takes only about 0.45sec and performance is over 17Gbps. I know this is impossible but I can't find anything wrong in m...
more »

2017-08-24 17:08 (1) Answers

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