Questions tagged [io]

In computing, input/output, or I/O, refers to the communication between an information processing system (such as a computer), and the outside world, possibly a human, or another information processing system.

In computing, input/output, or I/O, refers to the communication between an information processing system (such as a computer), and the outside world, possibly a human, or another information processing system.

(Source: Wikipedia [Input/Output])


I/O includes tasks such as:

  • Reading and writing files ()
  • Interacting with a user through a command-line terminal session ( / / )
  • Connecting programs so that one sends its output to the next (s)
  • Sending data over a network in packets or as a data stream ()

For the Io language, see

17482 questions
6
votes
1 answer

System.IO.Abstractions usage

I'm writing some unit tests using System.IO.Abstractions following the sample code in GitHub and got stuck here: fileSystem: new FileSystem() //use default implementation which calls System.IO This line is meant to initialise System.IO.FileSystem…
Gaby
  • 61
  • 1
  • 1
  • 3
6
votes
1 answer

Java Scanner won't follow file

Trying to tail / parse some log files. Entries start with a date then can span many lines. This works, but does not ever see new entries to file. File inputFile = new File("C:/test.txt"); InputStream is = new FileInputStream(inputFile); InputStream…
6
votes
2 answers

C++: get number of characters printed when using ofstream

The C fprintf() function returns the number of characters printed. Is there similar functionality in C++ when writing to a file with ofstream? I am interested in a solution that is compatible with C++03 if possible. For example: ofstream…
user327301
  • 2,641
  • 2
  • 26
  • 33
6
votes
2 answers

How to compress alphanumeric strings?

I want to shrink Strings like -1234B56789C;ABC1D3E/FGH4IJKL which are approx 20 - 25 case-insensitive chars. My goal is to have an alphanumeric string that is a maximum of 16 characters. They must remain human readable. Is that possible? Are there…
membersound
  • 81,582
  • 193
  • 585
  • 1,120
6
votes
3 answers

Writing integers in binary to file in python

How can I write integers to a file in binary in Python 3? For example, I want to write 6277101735386680763835789423176059013767194773182842284081 to a file in binary in exactly 24 bytes (unsigned, I will only be working with positive integers). How…
Dasherman
  • 353
  • 1
  • 5
  • 17
6
votes
7 answers

How to load/save C++ class instance (using STL containers) to disk

I have a C++ class representing a hierarchically organised data tree which is very large (~Gb, basically as large as I can get away with in memory). It uses an STL list to store information at each node plus iterators to other nodes. Each node has…
ati
  • 307
  • 3
  • 10
6
votes
5 answers

How to decompress a gzipped data in a byte array?

I have a class which has a method that is receiving an object as a parameter. This method is invoked via RMI. public RMIClass extends Serializable { public RMIMethod(MyFile file){ // do stuff } } MyFile has a property called…
rshepherd
  • 1,396
  • 3
  • 12
  • 21
6
votes
7 answers

When to build your own buffer system for I/O (C++)?

I have to deal with very large text files (2 GBs), it is mandatory to read/write them line by line. To write 23 millions of lines using ofstream is really slow so, at the beginning, I tried to speed up the process writing large chunks of lines in a…
Bocaballena
  • 63
  • 1
  • 5
6
votes
2 answers

Generating a FileDescriptor on Android without first opening a file

In Android, is it possible to generate a FileDescriptor directly from a byte array, without having to open a file first? In Android 2.2, I am generating a MIDI file on the fly, and then playing it back using MediaPlayer. I've included the text of…
James Newton
  • 6,623
  • 8
  • 49
  • 113
6
votes
3 answers

How exactly does unlink work?

I'm having a little difficulty understanding how exactly this works. It seems that unlink() will remove the inode which refers to the file's data, but won't actually delete the data. If this is the case, a) what happens to the data? Presumably it…
CFK
  • 83
  • 1
  • 3
6
votes
1 answer

git add . --quiet: quiet option not available

I've just untargzipped some code and I want to add a whole bunch of files at once to the repository and commit. Unfortunately git add doesn't have a --quiet flag and all that I/O to print every single file from the tarball is slowing things down.…
John Sonderson
  • 3,238
  • 6
  • 31
  • 45
6
votes
1 answer

Making an Agda program output to the console

I've been using Agda for 9 months now. For the first time, I find myself wanting to "run" (as a top-level executable) an Agda program that prints a string. Call me old-fashioned. I can write a program that computes a string and get Agda to show me…
Roly
  • 2,126
  • 2
  • 20
  • 34
6
votes
1 answer

How to write without a newline in Fortran?

I'm writing a piece of code by which I plan to write a .txt file that's a 10x10001 matrix: do i = 1, 10 read(1,10) seed !Read a number from file 1 write(2,20) seed !Write that number in file 2 do k = 1, 10000 seed =…
Miguelgondu
  • 249
  • 1
  • 2
  • 12
6
votes
6 answers

Why is Python faster than C++ in this case?

A program in both Python and C++ is given below, which performs the following task: read white-space delimited words from stdin, print the unique words sorted by string length along with a count of each unique word to stdout. The format for a line…
OregonTrail
  • 8,594
  • 7
  • 43
  • 58
6
votes
2 answers

What is datatype of FILE?

What is the data type of FILE in C or in other language? Is it an integer or structure or having no particular data type?
Munavar Fairooz
  • 219
  • 1
  • 3
  • 10