|
What I need to do is use the read function from unistd.h to read a file line by line. I have this at the moment:
n = read(fd, str, size);
However, this reads to the end of the file, or up to size number of bytes. Is there a way that I can make it read...
Started by Will on
, 7 posts
by 7 people.
Answer Snippets (Read the full thread at stackoverflow):
This is a good question, but allowing only the read function doesn't help! :P
Loop read calls to get....
You can read character by character into a buffer and check for the linebreak symbols ( \r\n for Windows and \n for Unix systems).
|
|
I have a C++ File class with read function, that is supposed to read whole contents of a file (just like Python does) into a buffer. However, when I tried to call read function from unistd.h, I get:
file.cpp:21: error: no matching function for call to...
Started by gruszczy on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
This is neccesary....
}
?
The definition for the posix standard version of the read method is defined as extern "C" .
Have you tried being explicit about scope;
char* File::read() { // Double-colon to get to global scope ::read(...); // ..
|
|
The last book I read was Harry Potter 5, I'm currently halfway through "The help" and will read either "catcher in the rye" or "girl with dragon tatoo" next.
how about you guys?
Started by ali_bl-nov05 on
, 23 posts
by 22 people.
Answer Snippets (Read the full thread at thebump):
Last read: In the Garden of Beasts - Erik Larsson
Currently reading: Catherine by....
I last read I Am Hutterite , currently reading Mennonite In A Little Black Dress , and will read and just couldn't keep reading.
|
Ask your Facebook Friends
|
I'm reading/writing data off of a named pipe. On the writing side it says that it's writing a constant 110 bytes. On the Reading side for the majority of time it says that it's reading 110 bytes which is correct, but other times it says its reading 22...
Started by whatWhat on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
Put it differently....
Written data will be added to the end of buffer .
The writer process might write to the pipe a couple of times before a read is encountered.
Your assumption that a read will execute immediately after a write is not true.
|
|
Http://bash.cyberciti.biz/file-management/shell-script-to-simulate-unix-more-command/
#!/bin/bash # Write a shell script like a more command. It asks the user name, the # name of the file on command prompt and displays only the 15 lines of # the file ...
Started by Shadyabhi on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Try
read key <&3
Just for the record, here's yet another more script:
# Author: Steve Stock # http://www.linuxjournal.com/article/7385 (comments) shmore() { LINES="" while read -d $'\n' line; do--" read < /dev/tty LINES="" ....
|
|
I'm a big fan of ido-mode , so much so that I would like to use it for things like describe-function or find-tag and so on, without having to write something like in "Can I get ido-mode-style completion for searching tags in Emacs?" for each one.
Both...
Started by haxney on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
In particular, ido-completing....
Just a thought: have you tried editing ido-completing-read to call original-completing-read instead of completing-read , defining original-completing-read to be the current completing-read.
|
|
Hello all,
Im reading from a file (data.bin) using the following approach -
fis1 = new FileInputStream(file1); String data; dis1 = new DataInputStream(fis); buffread1=new BufferedReader(new InputStreamReader(dis1)); while( (data= buffread1.readLine())...
Started by ping on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
To learn more about the IO essentials.
Rather use an InputStream instead of Reader to read binary data.
You don't want to read it entirely as character data .
That look like part of binary data.
|
|
I'm having an issue reading from a java input stream. I have a buffer of size 1024, and an input stream of size 29k-31k. I read the inputStream in a loop, but I only get 29 bytes for the first read, 39 for the second read, and nothing after that. The ...
Started by Tamar on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
Have you tried using readline() instead of read()?
Path file = ...; InputStream.
Of the read call.
|
|
I am wondering when I read a response stream and a timeout occurs, can I retry the read? Or do I have to make a new request? The server that I am downloading from does not support resuming, so I need to protect against timeouts.
Started by John Sheares on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If the server indeed....
You need to reissue the request How do you know that the server doesn't accept resumes? Is the Accept-Ranges header indeed lacking in the response? If not, you could resume the request using the Range header .
No, you can't retry.
|
|
Has anyone encountered a problem with emacs on windows and java input ? (read-line) in the REPL does not recognise the delimiter (well thats my guess).
Using a vanilla clojure in the box, same issue.
Further clarification.
Using (read-line) or the scanner...
Answer Snippets (Read the full thread at stackoverflow):
I'll see what Phil has to say..
This is a (I suppose?) known bug.
I strongly recommend using the emacs starter kit with slime, all of which can be downloaded from => http://technomancy.us/126 .
|