Questions tagged [file-read]

This tag can be used on questions about reading files.

To work with stored data, file handling belongs to the core knowledge of every programmer. One of the core file handling methods is reading a file.

Resources:

644 questions
-2
votes
2 answers

read .doc file using scala

I want to read .doc file in scala. I tried using apache.poi library for this but the method HWPFDocument(java.io.InputStream istream) accepts java io stream. If anyone can shed some light on this, that would great!
Priyanka
  • 82
  • 1
  • 8
-2
votes
1 answer

Last file line reading gives different results

I am trying to read strings from a file with contents like: r FFFF r FF r FFFF Here is my code: int main () { int a; ifstream ifile; ifile.open("hi.txt"); while (!ifile.eof()) { ifile.getline(data, 100); // read a line from…
-2
votes
4 answers

Unable to read simple text file Java

Hi I've been asked to write code that will read a text file in the same directory as my .class file. I've written a simple program that reads "input.text" and saves it to a string. /** Import util for console input **/ import java.util.*; import…
Ed Byrne
  • 29
  • 1
  • 6
-2
votes
1 answer

C Language - how do I fix my Binary Search Function in my code?

This is what I have #include #include void print(int a[], int size); void sort (int a[], int size); void swap (int* a, int *b); int search(int searchValue, int a[], int size); int main() { …
-2
votes
1 answer

File Reading for Console

Am making a dictionary and have to read various file from various folder of various types! i have found the code for displaying folder in a directory on console! however i dnt understand how to read the txt files inside those folders! and display…
Plotter
  • 39
  • 1
  • 3
  • 12
-2
votes
4 answers

php file read function

I am using the following file read $myFile = "file.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); echo $theData; problem is file.txt is generating dynamically and is in different folder so how do I call it…
user1561466
  • 71
  • 1
  • 3
  • 11
-3
votes
1 answer

Reading the content of a css file using Java

I am trying to read a css file, find out the css classes and their definition and then save it in a csv file with its class name and description. Using Java, the following I have css file, common.css. /* CSS Document */ .Page { …
Vaishali
  • 11
  • 1
  • 5
-3
votes
2 answers

Read file contents in python conditionally

I am trying to read one chromosome sequence from a genome file in python. The format of the genome file is like the following but with more lines of sequence for each…
Liyong
  • 1
  • 3
-3
votes
1 answer

How can parse these file pattern in php?

I have some .ini file to read by PHP. Then, the styles of file contents are as follows; [title1] delete_date = 0101,0211,1115 [title2] setting_day_name = aaa, bbb setting_day = 0811, 1201 [title3] company = c1,c2,c3 I want some arrays with each…
blue pine
  • 472
  • 6
  • 17
-3
votes
2 answers

Escape characters when joining strings

Trying to read a .csv file content from folder. Example code: Files_in_folder = os.listdir(r"\\folder1\folder2") Filename_list = [] For filename in files_in_folder: If "sometext" in filename: …
-3
votes
2 answers

python to find line within a text file

I have a text file with entries like these: address-object ipv4 "DRV FIL01" name "DRV FIL01" ID 00000000-0000-002a-0100-c0eae46ae3f4 zone LAN_General host 10.4.12.7 address-object ipv4 "DRV FIL02" name "DRV FIL02" ID…
patrisilva
  • 15
  • 2
-3
votes
1 answer

Read a file and put specific values to an array

I am a newbie to bash scripting. I have a file containing some values. I want to put all the values of a specific key into an array in bash. The file looks like this. file.properties name=val1 name=val2 name=val3 age=val4 I want to read this file…
-3
votes
1 answer

C++ read different kind of datas from file until there's a string beginning with a number

In C++, I'd like to read from an input file which contains different kind of datas: first the name of a contestant (2 or more strings with whitespaces), then an ID (string without whitespaces, always beginning with a number), then another strings…
chuck
  • 63
  • 12
-3
votes
1 answer

Java read file line by line to a specific seek position

I want to read a file line by file to a specified seek position. It is easy to start reading from a certain seek position and read further till end. RandomAccessFile f = new RandomAccessFile("file.txt","r") f.seek(seek) This set file reading…
Shashwat Kumar
  • 5,159
  • 2
  • 30
  • 66
-3
votes
1 answer

Read points from a stream that is only one line

I have a file which first tells me how many points will I be reading on the following line. So, for example my file look like this: 7 a,b c,d e,f g,h, i,j k,l m,n So I know the following line after 7 is 7 pairs of integers separated by a comma and…
David Merinos
  • 1,195
  • 1
  • 14
  • 36
1 2 3
42
43