Questions tagged [readfile]

ReadFile() is a Windows API function to read data from the specified file or input/output (I/O) device. Reads occur at the position specified by the file pointer if supported by the device.

2383 questions
10
votes
6 answers

string replace in a large file with php

I am trying to do a string replace for entire file in PHP. My file is over 100MB so I have to go line by line and can not use file_get_contents(). Is there a good solution to this?
Brian
  • 26,662
  • 52
  • 135
  • 170
9
votes
5 answers

Java: Read array of integers from file

Say i have a file called "input.txt" that has a bunch of positive integers in it: 6 5 6 8 6 2 4 and so on....(one integer per line) I want to read this file and make it into an array. The first integer (in this case 6) tells the number of indexes…
user986024
  • 111
  • 1
  • 1
  • 3
9
votes
2 answers

How to split a vector into list breaking at a specific value

How can I split the following vector to list with every new element whereever an empty '' value is encountered? For e.g. Given the following input- x <- c("abc", "", "a", "b", "c", "", "ab", "ac", "", "a", "a", "a", "a", "", "b") x [1] "abc" "" …
AnilGoyal
  • 25,297
  • 4
  • 27
  • 45
9
votes
1 answer

How to convert string to File object in javascript ?

I am trying to convert string to File object in javascript but I get an error. my code: var contents = fs.readFileSync('./dmv_file_reader.txt').toString() var readerfile1 = new File([""], contents); (i have to use contents as file and not…
Tom Cohen
  • 143
  • 1
  • 4
  • 11
9
votes
2 answers

How Python reads a file when it was deleted after being opened

I'm having difficulties in understanding the concept of how Python reads a file when it was deleted after being open'ed. Here is the code: >>> import os >>> os.system('cat foo.txt') Hello world! 0 >>> f <_io.TextIOWrapper name='foo.txt' mode='r'…
Mikhail Geyer
  • 881
  • 2
  • 9
  • 27
9
votes
4 answers

How to read line by line by using FileReader

Thank you for your attention. I have created a program which I'm using a Login form and Register form. Once users register their email and their password will be saved it into submit.txt. Then they will turn back to login form and enter their email…
Ender phan
  • 185
  • 2
  • 3
  • 10
9
votes
3 answers

Win32 ReadFile hangs when reading from pipe

I am creating a child process, and reading its output. My code works fine when the child process creates output (cmd /c echo Hello World), however ReadFile will hang if process does not create output (cmd /c echo Hello World > output.txt). I am only…
Matt
  • 774
  • 1
  • 10
  • 28
8
votes
6 answers

Why is file I/O in large chunks SLOWER than in small chunks?

If you call ReadFile once with something like 32 MB as the size, it takes noticeably longer than if you read the equivalent number of bytes with a smaller chunk size, like 32 KB. Why? (No, my disk is not busy.) Edit 1: Forgot to mention -- I'm…
user541686
  • 205,094
  • 128
  • 528
  • 886
8
votes
2 answers

How to read local files using HTML 5 FileReader?

Objective I am making an application, and I need to read a local file using JavaScript and HTML 5, without any tags or user interaction whatsoever. What I tried On my research, I found two tutorials that are heavily cited in…
Flame_Phoenix
  • 16,489
  • 37
  • 131
  • 266
8
votes
6 answers

Read json file ignoring custom comments

How can i read this file 'file.json': # Comment01 # Comment02 { "name": "MyName" } and retrieve the json without comments? I'm using this code: var fs = require('fs'); var obj; fs.readFile('./file.json', 'utf8', function (err, data) { if…
Hemã Vidal
  • 1,742
  • 2
  • 17
  • 28
8
votes
4 answers

Is it possible to read entitlements files in swift

I am implementing universal deep linking in my app. When I registered my different domains, it creates an AppName.entitlements file I would like to read the values of this file like a plist. I tried if let path =…
kschaeffler
  • 4,083
  • 7
  • 33
  • 41
8
votes
2 answers

Json file to powershell and back to json file

I am trying to manipulate json file data in powershell and write it back to the file. Even before the manipulation, when I just read from the file, convert it to Json object in powershell and write it back to the file, some characters are being…
Romonov
  • 8,145
  • 14
  • 43
  • 55
8
votes
4 answers

PHP readfile() corrupts file

In my function I'm downloading a file that saves downloads to a log file. Whenever I try to download an Excel file I uploaded, Excel states that it is corrupted. My local copy works fine. Here is my download.php:
8
votes
2 answers

C++ - Read from file to double

I'm relatively new to programming and taking a course in C++ currently. I haven't had any major problems so far. I am making a program where an X amount judges can score 0.0 - 10.0 (double) and then the highest and lowest one is removed then an…
Danieboy
  • 4,393
  • 6
  • 32
  • 57
8
votes
4 answers

C# - Most effective way to periodically read last part of a file

I want to periodically read a log file that is also being written to. The program will be periodically reading the log file contents and parsing it to extract some values. But I do not want to read the whole file each time. Is there a way to read a…
madu
  • 5,232
  • 14
  • 56
  • 96