This tag refers to the process of writing text or data to a file.
Questions tagged [file-writing]
932 questions
2
votes
1 answer
Java: How to remove  character appearing before £
Whenever I print or write the £ symbol , or even do anything with it, it is always displayed as £ with no reason for the  to be there. I have tried writing the character in unicode but it still resulted in this weird combination. Is there any way…

Thomas Rowe
- 21
- 2
2
votes
1 answer
How do you write a dictionary to a CSV file on a line that already contains text?
I'm using python 3.6.0. I have written dictionaries to CSV files before, but never on lines that already contains text. I am having trouble with that now. Here's my code:
import csv
f='/Users/[my…

dxxg-syz35
- 101
- 1
- 10
2
votes
1 answer
Application.persistentDataPath Failed
I have updated my unity to 2017.4.0f1 and I have script about saving some info
inside a text-like file. I have used
public static string savePath = Application.persistentDataPath + "/";
but I get this error
get_persistentDataPath is not allowed…

Seyed Mahdi Mostafavi
- 23
- 2
- 8
2
votes
0 answers
Implement Multiple client reads a file and multiple servers writes to a file via Client Server
Below is the question, I was asked in an interview,
Datacenter has 10000 servers.We have a single syslog driver which collates all the logs from all the servers in the datacenter and writes it in a single file called syslog.log
Let's say the…

irs102info
- 526
- 1
- 6
- 16
2
votes
2 answers
RandomAccessFile writeInt(int i) vs write(byte[] b) - performance
I've faced an interesting thing today regarding RandomAccessFile.
I've noticed that using RandomAccessFile's writeInt(int i) method is much more slower than using RandomAccessFile's write(byte[] b) where I first convert int value to byte[4] array.…

Kristoff
- 326
- 2
- 13
2
votes
2 answers
Using .write() in Python only writes a single line
So, as an assignment from Thenewboston, I'm trying to grab a block of code from his site and write it to a file. The code grabbing part works just fine, but the writing part doesn't work:
import requests
from bs4 import BeautifulSoup
def…

SirDarknight
- 83
- 1
- 2
- 11
2
votes
1 answer
Files created in Vagrant centos/7 do not appear in Windows
I have primarily used Ubuntu boxes in Vagrant and in those any files created within the box have been successfully synced to Windows also. Usually things like git pull.
However, I now have centos/7 and cannot get any files to sync to Windows. If you…

Juha Untinen
- 1,806
- 1
- 24
- 40
2
votes
0 answers
Is Files.write() method thread safe.
Is the following method provided by Java NIO thread safe?
public static Path write(Path path,
Iterable extends CharSequence> lines,
Charset cs,
OpenOption... options)
throws IOException
The API doesn't say anything…

Mayuran
- 669
- 2
- 8
- 39
2
votes
2 answers
How to format print statements with two vector variables?
I'd like to write several messages and tables on the same .txt file.
For example:
x=[23.9,10.9,8.9,14.2]
y=[9.83,8.04,7.47,8.32]
file=fopen('Results.txt','wt');
fprintf(file,'Results1\n');
fprintf(file,'%.2f…

fititis kosmas
- 21
- 2
2
votes
1 answer
Write to temp file and read from command line
I need to write a temporary file to a n*x machine using python3 so that I can read it from the command line.
import tempfile
import subprocess
from os import path
string = 'hi *there*'
# run markdown server-side
tfile =…

mareoraft
- 3,474
- 4
- 26
- 62
2
votes
3 answers
Write an array to multi column CSV format using Ruby
I have an array of arrays in Ruby that i'm trying to output to a CSV file (or text). That I can then easily transfer over to another XML file for graphing.
I can't seem to get the output (in text format) like so. Instead I get one line of data…

Ryan Anderson
- 121
- 2
- 11
2
votes
1 answer
Python-Multiple writing the same line in txt file
I have code like this:
def export_devices():
code = input("Enter device code: ")
amount = int(input("How many devices you export: "))
with open("uredjaji.txt", "r+") as f:
current_position = 0
line =…

Нео
- 63
- 2
- 10
2
votes
1 answer
Newline "\n" not Working when Writing a .txt file Python
for word in keys:
out.write(word+" "+str(dictionary[word])+"\n")
out=open("alice2.txt", "r")
out.read()
For some reason, instead of getting a new line for every word in the dictionary, python is literally printing \n between every key…
user7792600
2
votes
2 answers
Write data in existing file Yii2 framework
I am trying to write data in a json file from yii2 framework. It's returning error failed to open stream. My code is given below.
$productjson = json_encode($value);
echo $jsonfile=Yii::$app->view->theme->baseUrl.'/assets/json/aresult.json';
$fp =…

M.Kaisar
- 63
- 1
- 8
2
votes
3 answers
DAO Class not writing to file
I'm attempting to make a login system by using a model and DAO class to write users to a file called users.txt
In my controller, I created an initialize method:
public void initialize(){
User user = new User();
user.addUser();
}
Here's the…

cosmo
- 751
- 2
- 14
- 42