Questions tagged [read-write]

Read/write is a mode of access designating the intent or ability to perform both read and write operations on a entity.

Read/write typically denotes the ability or desire to both view and alter the contents on a file or other writable object.

In many cases this would suggest full access to a resource expect possibly in terms of use (e.g. a user have read and write but not execute access to a binary).

633 questions
172
votes
4 answers

Open files in 'rt' and 'wt' modes

Several times here on SO I've seen people using rt and wt modes for reading and writing files. For example: with open('input.txt', 'rt') as input_file: with open('output.txt', 'wt') as output_file: ... I don't see the modes…
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
102
votes
16 answers

Create thread safe array in Swift

I have a threading problem in Swift. I have an array with some objects in it. Over a delegate the class gets new objects about every second. After that I have to check if the objects are already in the array, so I have to update the object,…
patrickS
  • 3,590
  • 4
  • 29
  • 40
54
votes
8 answers

How to access file included in app bundle in Swift?

I know there are a few questions pertaining to this, but they're in Objective-C. How can I access a .txt file included in my app using Swift on an actual iPhone? I want to be able to read and write from it. Here are my project files if you want to…
atirit
  • 1,492
  • 5
  • 18
  • 30
54
votes
8 answers

How to read/write arbitrary bits in C/C++

Assuming I have a byte b with the binary value of 11111111 How do I for example read a 3 bit integer value starting at the second bit or write a four bit integer value starting at the fifth bit?
dtech
  • 47,916
  • 17
  • 112
  • 190
52
votes
3 answers

.NET Excel Library that can read/write .xls files

I'm looking for an Excel library which reads/writes .xls (not .xlsx) files. I'm using excellibrary but it's very buggy and I can't seem to open the files I create. The issue has been known for almost a year and hasn't been fixed yet. I've seen in…
Ozzah
  • 10,631
  • 16
  • 77
  • 116
32
votes
16 answers

Reading/Writing a MS Word file in PHP

Is it possible to read and write Word (2003 and 2007) files in PHP without using a COM object? I know that I can: $file = fopen('c:\file.doc', 'w+'); fwrite($file, $text); fclose(); but Word will read it as an HTML file not a native .doc file.
UnkwnTech
  • 88,102
  • 65
  • 184
  • 229
29
votes
2 answers

Open file with system application in a Progressive Web App

I'm trying to figure out if it is possible to open a file from a Progressive Web App with the default system application. The idea is that a PWA would store for offline use some files (e.g. a .docx file), and that the user would be able to open them…
don
  • 4,113
  • 13
  • 45
  • 70
26
votes
1 answer

Benefits of object.get() vs object.read() in Grails

I was skimming some of the Grails documentation and found this bit about the read() method in Grails. If I'm understanding this correctly, you can pull a "read-only" version of an object from the database that will only be saved on an explicit…
Mike Caputo
  • 1,156
  • 17
  • 33
25
votes
5 answers

Writing to stdin and reading from stdout (UNIX/LINUX/C Programming)

I was working on an assignment where a program took a file descriptor as an argument (generally from the parent in an exec call) and read from a file and wrote to a file descriptor, and in my testing, I realized that the program would work from the…
Tim
  • 301
  • 1
  • 5
  • 8
22
votes
9 answers

Bash read/write file descriptors -- seek to start of file

I tried to use the read/write file descriptor in bash so that I could delete the file that the file descriptor referred to afterward, as such: F=$(mktemp) exec 3<> "$F" rm -f "$F" echo "Hello world" >&3 cat <&3 but the cat command gives no output.…
telotortium
  • 3,383
  • 2
  • 23
  • 25
21
votes
5 answers

Adding items to Swift array across multiple threads causing issues (because arrays aren't thread safe) - how do I get around that?

I want to add given blocks to an array, and then run all the blocks contained in the array, when requested. I have code similar to this: class MyArrayBlockClass { private var blocksArray: Array<() -> Void> = Array() private let blocksQueue:…
Andrew
  • 7,693
  • 11
  • 43
  • 81
19
votes
4 answers

Reading/Writing MS Word files in Python

Is it possible to read and write Word (2003 and 2007) files in Python without using a COM object? I know that I can: f = open('c:\file.doc', "w") f.write(text) f.close() but Word will read it as an HTML file not a native .doc file.
UnkwnTech
  • 88,102
  • 65
  • 184
  • 229
16
votes
6 answers

Read and Write permission for storage and gallery usage for marshmallow

I am developing an android app in which it is required to provide permission for Read and write external storage. My requirement is to select a picture from gallery and use it in my app. Everything is working fine except Marshmallow devices. I want…
15
votes
3 answers

Python Write Replaces "\n" With "\r\n" in Windows

After looking into my question here, I found that it was caused by a simpler problem. When I write "\n" to a file, I expect to read in "\n" from the file. This is not always the case in Windows. In [1]: with open("out", "w") as file: ...: …
fon01234
  • 379
  • 4
  • 10
15
votes
4 answers

How to read/write local files through a web page?

I am writing a html based app, and want to store and retrieve data from local file. This app will not be hosted on a web server. Can anyone please help enlighten the topic on how can this be done?
praneybehl
  • 3,801
  • 6
  • 28
  • 45
1
2 3
42 43