I need to write data into drive. I have two options:
write raw sectors.(_write(handle, pBuffer, size);)
write into a file (fwrite(pBuffer, size, count, pFile);)
Which way is faster?
I expected the raw sector writing function, _write, to be more efficient. However, my test result failed!
fwrite is faster. _write costs longer time.
I'v...
I'm passing some Base64 encoded strings through WCF, and I'm attempting to write them to a file. However, despite the fact that my FileStream object has a Length greater than 0, my file on disk remains empty.
FileStream fs = new FileStream(Config.Instance.SharedSettings.SaveDir + StudyInstance.StudyId + "\\tmp.ext", FileMode.Create);
E...
Hi,
I am trying to figure out how to write a binary file with a FileStream and BinaryWriter, and keep the file locked for read while I am writing. I specifically dont want other applications/processes to be able to read from the while while its being written to.
//code to declare ba as a byte array
//dpath is the path to the file
Fi...
EDIT: Optimization results at end of this question!
hi, i have a following code to first scan files in a specific folder and then read every file line by line and after numerous "if...else if" write new modified file to another folder with the name name as it was when opened.
The problem is that writing a file line by line seems to be ...
Hello,
Maybe somebody could help me. I need a two methods.
The first should open a xml file and get all nodes with the given parameter ie.:
XML file (file.xml):
<Menu id="1" Name="myMenu">
<MenuItem Header="Header 1" Name="header1" />
<MenuItem Header="Header 2" Name="header2">
<MenuItem Header="subHeader 2.1" Name="header2_...
What is the most efficient class to use to read from and write to console in Java?
...
I'm making this program and I'm trying to find out how to write data to the beginning of a file rather than the end. "a"/append only writes to the end, how can I make it write to the beginning? Because "r+" does it but overwrites the previous data.
$datab = fopen('database.txt', "r+");
Here is my whole file:
<!DOCTYPE HTML PUBLIC "-/...
I'm trying to write a file from my Java program, but nothing happens. I'm not getting any exceptions or errors, it's just silently failing.
try {
File outputFile = new File(args[args.length - 1]);
outputFile.delete();
outputFile.createNewFile();
PrintStream output = new PrintStream...
Hello everybody!!!
I have this script on one free PHP-suppoting server:
<html>
<body>
<?php
$file = fopen("lidn.txt","a");
fclose($file);
?>
</body>
</html>
it does create the lidn.txt file, but it's empty.
I want to create a file and to write something into it,
for example this line "Cats chase mice", how can I do it?
...
can somone tell me how to write these hexadecimals to an exe file while still having it exec
4D 5A 50 00 02 00 00 00 04 00 0F 00 FF FF 00 00 B8 00 00 00 00 00 00
00 40 00 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 BA 10 00 0E 1F
B4 09 CD 21 B8 01 4C CD 21 90 90...
Hi,
I'm trying to write a matrix into a text file.
In order to do that I'd like to know how to write an array into a line in the text file.
I'll give an example:
int [] array = {1 2 3 4};
I want to have this array in text file in the format:
1 2 3 4
and not in the format:
1
2
3
4
Can you help me with that?
Thanks a lot
...
Hello all.
What's the different between Console.Write("H") and Console.Write('H') in C#. thanks.
:-)
...
Let's say I need to save a matrix(each line corresponds one row) that could be loaded from fortran later. What method should I prefer? Is converting everything to string is the only one approach?
...
Imagine you have a library for working with some sort of XML file or configuration file. The library reads the whole file into memory and provides methods for editing the content. When you are done manipulating the content you can call a write to save the content back to file. The question is how to do this in a safe way.
Overwriting th...
I've been trying to learn Go / Golang on my own, but I've been stumped on trying read and write to ordinary files.
I can get as far as: inFile,_ := os.Open(INFILE,0,0);
but actually getting the content of the file doesn't make sense, since the read function takes a []byte as a parameter??
func (file *File) Read(b []byte) (n int, err E...
Hi
I want to create a xml file dynamically for my Iphone application. I tried it by using NSXMLDocument but NSXMLDocument is not declared in iphone application.
Please help me in doing so.
Thanks
Gaurav
...
What's the simplest way for me, in PHP, to:
Retrieve a file from an external URL (http://test.com/thisfile)
If successful, delete local file /root/xml/test.xml
Rename downloaded file to test.xml
Write new file to /root/xml/ folder
This will be a private script, so security or error handling are not important concerns.
...
hey Guys,
I know this question is probably straightfoward but I'm new to php and programming...
I want to write the results of a recursive search to a text file, and also ensuring that any other search performed will not overwrite the exisiting data, but add to it.
here is my code:
<?php
$it = new RecursiveDirectoryIterator("L:\fol...
I have asked a related question in the past and I know how to read the file thanks to the help of the experts here. Now I have a new problem. I first read the data from the file like so:
fid = fopen('D:\file.txt', 'rt');
a = textscan(fid, '%s %f %f %f %f %f %f', ...
'Delimiter',',', 'CollectOutput',1, 'HeaderLines',1);
fclo...
Hello.
I googled and found the solution at MSDN.
// Compose a string that consists of three lines.
string lines = "First line.\r\nSecond line.\r\nThird line.";
// Write the string to a file.
System.IO.StreamWriter file = new System.IO.StreamWriter("c:\\test.txt");
file.WriteLine(lines);
file.Close();
How to extend the lines to comp...