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.
Questions tagged [readfile]
2383 questions
25
votes
6 answers
CLion C++ can't read/open .txt file in project directory
I have a .txt file in my project directory that I made and populated with data.
directory structure looks like:
/Users/asd/ClionProjects/ProjectWithTemplates/
main.cpp
cmake
twoday.txt
here is my code:
#include
#include
#include…

Rekumaru
- 421
- 1
- 4
- 10
23
votes
6 answers
Why does readfile() exhaust PHP memory?
I've seen many questions about how to efficiently use PHP to download files rather than allowing direct HTTP requests (to keep files secure, to track downloads, etc.).
The answer is almost always PHP readfile().
Downloading large files reliably in…

tmsimont
- 2,651
- 2
- 25
- 36
23
votes
4 answers
C++ Read file line by line then split each line using the delimiter
I want to read a txt file line by line and after reading each line, I want to split the line according to the tab "\t" and add each part to an element in a struct.
my struct is 1*char and 2*int
struct myStruct
{
char chr;
int v1;
int…

sikas
- 5,435
- 28
- 75
- 120
22
votes
3 answers
DOMException: The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired
when i trying to read file using FileReader and the file size is 5.9gb and when this code run
var file = document.getElementById('uploadFileId').files[0];
let reader = new FileReader();
reader.onerror = function() {
…

satish wanjari
- 241
- 1
- 3
- 4
22
votes
2 answers
How do I read a file line by line in VB Script?
I have the following to read a file line by line:
wscript.echo "BEGIN"
filePath = WScript.Arguments(0)
filePath = "C:\Temp\vblist.txt"
Set ObjFso = CreateObject("Scripting.FileSystemObject")
Set ObjFile = ObjFso.OpenTextFile(filePath)
StrData =…

EGr
- 2,072
- 10
- 41
- 61
22
votes
1 answer
Is there heredoc alternative in Java (heredoc as PHP)?
For JAVA development I need writing to a files with strings like "\r\t\n <>", because from Java I want writing a PHP file. If you can't understand look at this example:
BufferedWriter buffW = new BufferedWriter(fileW);
…

Marin Sagovac
- 3,932
- 5
- 23
- 53
20
votes
4 answers
How to read a file starting from a specific line number using Scanner?
I am new to Go and I am trying to write a simple script that reads a file line by line. I also want to save the progress (i.e. the last line number that was read) on the filesystem somewhere so that if the same file was given as the input to the…

Amyth
- 32,527
- 26
- 93
- 135
20
votes
2 answers
Reading and using a custom configuration file
I'm currently working on a script which should analyze a dataset based on a 'configuration' file.
The input of this file is for instance:
configuration.txt:
123456, 654321
409,255,265
1
It can contain onther values as well, but they will al be…

Max van der Heijden
- 1,095
- 1
- 8
- 16
19
votes
4 answers
Reading file using fscanf() in C
I need to read and print data from a file.
I wrote the program like below,
#include
#include
int main(void)
{
char item[9], status;
FILE *fp;
if( (fp = fopen("D:\\Sample\\database.txt", "r+")) == NULL)
{
printf("No such…

Guru
- 207
- 2
- 4
- 8
18
votes
3 answers
How to get file read line by line
I have a file containing text in separate line.
I want to display line first, and then if I press a button, the second line should be displayed in the TextView and the first line should disappear. Then, if I press it again, the third line should be…

Sunny
- 14,522
- 15
- 84
- 129
17
votes
5 answers
How do I read and parse a text file with numbers, fast (in C)?
The last time update: my classmate uses fread() to read about one third of the whole file into a string, this can avoid lacking of memory. Then process this string, separate this string into your data structure. Notice, you need to care about one…

beasone
- 1,073
- 1
- 14
- 32
17
votes
2 answers
How to read a file's contents into an SQL variable
Could someone tell me how to read a file's contents into an MS SQL variable using T-SQL?

Babu James
- 2,740
- 4
- 33
- 50
16
votes
4 answers
skip some rows in read.csv in R
I have a csv file which I read using the following function:
csvData <- read.csv(file="pf.csv", colClasses=c(NA, NA,"NULL",NA,"NULL",NA,"NULL","NULL","NULL"))
dimnames(csvData)[[2]]<- c("portfolio", "date", "ticker", "quantity")
It reads all lines…

Dinoop Nair
- 2,663
- 6
- 31
- 51
15
votes
3 answers
Golang How to read input filename in Go
I would like to run my go file on my input.txt where my go program will read the input.txt file when I type in go run command ie:
go run goFile.go input.txt
I don't want to put input.txt in my goFile.go code since my go file should run on any…

Matt
- 739
- 2
- 6
- 10
15
votes
8 answers
PHP Streaming MP3
I have a very similar situation to the person who asked:
Can I serve MP3 files with PHP?
Basically I am trying to protect mp3 files from direct download, so users have to go through php to get authenticated first.
Here's my…

Yuval Karmi
- 26,277
- 39
- 124
- 175