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 display, an information storage system, or another information processing system).

Filter by
Sorted by
Tagged with
14
votes
1answer
107k views

Reading data from Excel sheet with ExcelDataReader

Objective: I want to import an Excel file, and read the rows of certain columns. For this, I use ExcelDataReader. I've implemented a low-level class called ...
4
votes
2answers
97 views

Accessing a certain I/O controller using memory-mapped I/O [closed]

I have a program that accesses a certain I/O controller using memory-mapped I/O. I currently store the base address of this controller in a const variable. This ...
6
votes
1answer
628 views

Combining contents of files by reading them in a human ordering

This code review is inspired by the this StackOverflow question and written in Java 8. The code is supposed to: Order all files, with syntax jobXXX.script, where <...
3
votes
3answers
10k views

Extracting text data from a file

Can I make this program that extracts text data from a file (size in MBs) even better performance-wise? I need to reduce the execution time. ...
7
votes
2answers
2k views

Speed up CSV reading code (vector of doubles)

I am trying to read a single-columned CSV of doubles into Java with a string header. It is 11 megabytes and takes over 15 minutes to read, which is clearly ...
7
votes
1answer
440 views

Node.js equivalent of cat -n or nl

To add line numbers to a file (via stdin to stdout) we can use cat -n or ...
10
votes
3answers
5k views

Writing .ppm images to a file

I am struggling with commenting and variable naming. My teacher says my comments need to be more explanatory and explicit. He says my variable names are also sometimes confusing. I was just wondering ...
6
votes
2answers
239 views

Parsing store sales content from a text file

I asked this question yesterday, and now I have come up with this code: stock.h ...
4
votes
1answer
376 views

Partial data reading implementation

I'm trying to learn Python and am working on a simple Tiled Map Format (.tmx) reader as practice. So as to not post too much code at once, I'm only publishing the ...
5
votes
2answers
18k views

Life, the Universe, and Everything [closed]

Your program is to use the brute-force approach in order to find the Answer to Life, the Universe, and Everything. More precisely... rewrite small numbers from input to output. Stop processing input ...
3
votes
2answers
4k views

Reading in a file and performing string manipulation

In a question I answered I posted the following code: ...
1
vote
1answer
6k views

Java PrintWriter not printing data to file [closed]

This program is compiling just fine, and the variables and such seem to be passing through. However, when I open the text file there is no data. Can anyone point me in the right direction or nudge ...
7
votes
2answers
321 views

Reading three rows of six tab-separated numbers

I've just posted this solution in my review of @adrienlucca's question, which is to read three rows of six tab-separated doubles. ...
4
votes
1answer
11k views

Writing integer to binary file

I wrote a python function that writes a integer to a file in binary form. But are there any ways that I can reduce the number of steps, is there a more efficient way to write a integer to a file? <...
2
votes
1answer
120 views

Better importation of variables from .txt file

I am an artist and a total beginner in C++. I would like to find a better method of importing my variables from a values.txt file, which may contain 18 values in ...
11
votes
7answers
22k views

Reading Large Files in Java getting really slow

I am trying to read a large file ~200 MB (~300 million lines of text). I am using a relatively standard way of reading like: ...
1
vote
2answers
142 views

Floating-Point data input in Bash and C

I wrote a function that dynamically stores statistical data. I tried to clone the functionality of how I had originally written my solution in Bash. Is there perhaps something I could improve, or do ...
3
votes
2answers
268 views

Is this file I/O utility efficient or is there a lot of fat?

This is a class/method that manages files being written to and read from. I have a lot of code, and it grew as I tried to get it to work properly. Is there a better way to write this (i.e. trim the ...
4
votes
3answers
2k views

Simple I/O class for reading input data fast

I wrote a FastReader utility class that is supposed to read input fast. It's mostly aimed at parsing input files in competitive programming. How could I made this ...
4
votes
2answers
551 views

K&R 1-20 Converting tabs to spaces using idiomatic C

I'm learning C with K&R 2nd Ed. I just completed exercise 1-20 (which is the detab program). I was hoping to get some feedback on my work. I want to make ...
3
votes
2answers
166 views

Attempting to efficiently compute the largest prime factor

I'm working on the third Euler problem and I've written a simple little function that returns the list of prime factors of a given number. The number for which I have to get all the factors is over 6 ...
2
votes
1answer
191 views

Vocabulary trainer passing around too much IO/State

I've written a vocabulary trainer which does a lot of passing state around, as I have an ACID-database and a temporary state. In my experience with Haskell I've learnt that overusing ...
4
votes
4answers
2k views

Reading a file into string in Java

I am quite new to Java, and I am trying to read a file into a string (or should I use byte arrays for this?). File can be anything, such as a text file or executable file etc. I will compress what I ...
3
votes
1answer
894 views

File I/O, SHA1 sum and compression

The function hash_blog is inspired by "how git stores its objects". It is supposed to take a String, append a header to it, ...
5
votes
2answers
875 views

Abstraction for an IO device

I have a C++ class which acts as an abstraction for an IO device which is controlled through file descriptors. As I am very new to C++, I would be glad if you can give me devastating feedback on ...
1
vote
1answer
140 views

Verifying column and line counts

I have created this simple code: For the size of an array with 2 values (n and m), verify if ...
4
votes
1answer
113 views

Detecting a combination of characters from input

Write a program that reads input up to # and reports the number of times that the sequence ei occurs. Is this a decent code? ...
7
votes
1answer
1k views

Mingw, wcout and locales

I've recently had to print some national symbols in windows console using Mingw and found, that I got nothing in the output, if I use wide strings. So, I studied ...
5
votes
4answers
6k views

C getline function

I was looking for a C function that reads lines of arbitrary length from a file. I didn't find anything absolutely portable and safe from buffer overflows, so I tried writing my own. Does it look ...
1
vote
2answers
516 views

User prompts for entering quiz questions

I have two methods here that does the same thing: get the user input and validate them. If they enter a letter, the program will prompt them again to enter a number. |After that, if it's a number it ...
3
votes
3answers
368 views

Simple text file I/O for book data

I wanted to learn how to work with file I/O properly and found an assignment in my college papers and decided to write it: ...
4
votes
1answer
9k views

Reading a .gz file

I am using Python 2.6.5 and am trying to find the fastest way to print out the contents of a .gz file. It's my understanding that prior to v2.5, zcat was much faster than gzip (see here)....I guess ...
5
votes
2answers
121 views

Ranking lines of a file according to number of occurrences

I recently dived into Ruby, so I want to improve this code. Is this good enough? ...
10
votes
3answers
6k views

Handle Java Process outputs without extra-threads

Usually, people would create two extra-threads in order to read the standard output and error respectively. However, the following code would allow to handle a Process outputs without those threads (...
6
votes
2answers
2k views

Slow web-scraping geolocator

How do I make my Python program faster? I have 3 suspects right now for it being so slow: Maybe my computer is just slow Maybe my Internet is too slow (sometimes my program has to download the html ...
5
votes
1answer
2k views

File reader/writer using XPConnect, ActiveX, LiveConnect, Java, HTML5 file storage, or HTTP

I am writing a file writer/reader in JavaScript; I want it to work on local files. It tries to use Firefox's XpConnect, falls back on IE activeX, falls back on Java LiveConnect, falls back on a Java ...
54
votes
2answers
72k views

Redirecting subprocesses' output (stdout and stderr) to the logging module

I'm working on a Python script and I was searching for a method to redirect stdout and stderr of a subprocess to the logging ...
3
votes
1answer
4k views

Reading a large XML file and parsing necessary elements into MySQLdb

I have fair concept in a programming (learner) but not an expert to refactor code at the highest level. I am trying to read a huge (100MB-2GB) XML file and parse necessary element (attributes) from a ...
1
vote
1answer
150 views

Iterating through 128-byte records in a file

I need to read records from a flat file, where each 128 bytes constitutes a logical record. The calling module of this below reader does just the following. ...
1
vote
2answers
12k views

Reading file contents into a string

Option 1 - nice and simple ...

1
5 6 7 8
9