Questions tagged [file-io]

File I/O is input/output that involves the file system. This could include performing operations on directories and files, such as creation and deletion, reading files, and writing output to files.

For an introduction on File I/O in C, see C Programming / File I/O on Wikibooks.

21104 questions
96
votes
5 answers

GZIPInputStream reading line by line

I have a file in .gz format. The java class for reading this file is GZIPInputStream. However, this class doesn't extend the BufferedReader class of java. As a result, I am not able to read the file line by line. I need something like this reader …
Kapil D
  • 2,662
  • 6
  • 28
  • 30
95
votes
9 answers

How can I extract the file name and extension from a path in C++

I have a list of files stored in a .log in this syntax: c:\foto\foto2003\shadow.gif D:\etc\mom.jpg I want to extract the name and the extension from this files. Can you give a example of a simple way to do this?
Octavian
  • 4,519
  • 8
  • 28
  • 39
93
votes
9 answers

Write a file in UTF-8 using FileWriter (Java)?

I have the following code however, I want it to write as a UTF-8 file to handle foreign characters. Is there a way of doing this, is there some need to have a parameter? I would really appreciate your help with this. Thanks. try { …
user1280970
  • 931
  • 1
  • 6
  • 3
92
votes
6 answers

Is there a way to use read.csv to read from a string value rather than a file in R?

I'm writing an R package where the R code talks to a Java application. The Java application outputs a CSV formatted string and I want the R code to be able to directly read the string and convert it into a data.frame.
tommy chheng
  • 9,108
  • 9
  • 55
  • 72
92
votes
4 answers

How to safely open/close files in python 2.4

I'm currently writing a small script for use on one of our servers using Python. The server only has Python 2.4.4 installed. I didn't start using Python until 2.5 was out, so I'm used to the form: with open('file.txt', 'r') as f: # do stuff…
TM.
  • 108,298
  • 33
  • 122
  • 127
92
votes
8 answers

jQuery: get the file name selected from

This code should work in IE (don't even test it in Firefox), but it doesn't. What I want is to display the name of the attached file. Any help? example