So a FILE stream can have both input and output buffers. You can adjust the output stream using setvbuf (I am unaware of any method to play with the input buffer size and behavior).
Also, by default the buffer is BUFSIZ (not sure if this is a POSIX or C thing). It is very clear what this means for stdin/stdout/stderr, but what are the d...
I've tried numerous ways of downloading files, specifically .zip and .tar.gz, with Ruby and write them to the disk.
I've found that the file appears to be the same as the reference (in size), but the archives refuse to extract. What I'm attempting now is:
Thanks!
def download_request(url, filePath:path, progressIndicator:progressBar) ...
#include<iostream>
#include<fstream>
#include<cstdlib>
#include<iomanip>
using namespace std;
int main()
{
ifstream in_stream; // reads itemlist.txt
ofstream out_stream1; // writes in items.txt
ifstream in_stream2; // reads pricelist.txt
ofstream out_stream3;// writes in plist.txt
ifstream in_stream4;// read recipt.tx...
I would like to delete a string or a line inside a ".txt" file (for example filen.txt). For example, I have these lines in the file:
1JUAN DELACRUZ
2jUan dela Cruz
3Juan Dela Cruz
Then delete the 2nd line (2jUan dela Cruz), so the ".txt" file will look like:
1JUAN DELACRUZ
3Juan Dela Cruz
How can I do this?
...
I'm writing an application whose purpose involves a lot of logging of different events. Among those I would also like to have an event that the application was shut down - even if unexpectedly like because of a power loss.
Naturally, when the power goes out I don't get a chance to write anything anywhere. So my idea was to continuously...
I have a zip library SharpZipLib which intended to work with ZIP archives using C#.
It has parameter ICSharpCode.SharpZipLib.Zip.ZipConstants.DefaultCodePage which specifies encoding of file names in zip archive. I know that in Windows and in OSX different encodings are used to store file names.
1) Which encodings (code pages) are used ...
Is there a way to get from the IOException object the file that fails?
...
this is my code:
f = open('text/a.log', 'wb')
f.write('hahaha')
f.close()
and it is not create a new file when not exist
how to do this ,
thanks
updated
class MyThread(threading.Thread):
def run(self):
f = open('a.log', 'w')
f.write('hahaha')
f.close()
error is :
Traceback (most recent call last):
...
I am using eclipse 3.4.I often keep searching for files in my project.I wanted to create a file search with filter.Like i should be able to configure the filter in preferences.later when i press ctrl+shift+ F (Assuming this is what i give the shortcut) it should display only those files.
Why i came up with this is bcos i might want to av...
Hello,
I am working on a chat implementation with Java sockets. I have focused on few functionalities, like authentication, one person chat and a group chat. I was thinking about adding file transfer functionality, and I wonder what's the good practice about this. Should I have separate socket on the server with different port listening...
Hello,
Can i share one application related data with another. Say I have a music file in resources/raw folder of apk2. Can I use the same file in apk1.
thx...
...
I have a swing Java application that preserves a lot of data (you can think of a game and its saves for example). Those data are stored in files rather then in database.
I would like to keep this files near installation files(.jar file) of my application.Some users(like me) are used to delete default application folder of OS when it com...
In Qt I need to send a sqlite file (binary file) up to a website using post. So what I do is that I open the file and try to read the content of it into a QByteArray that I with help of QNetworkRequest can send to the server. I can handle the request as the file is sent to the server but the file is just empty. Am I reading the content o...
I am aware that linux has timestamp info available to prog. langs. which is very handy.
I m developing a program and i need to append date time to the created file. and it should be unique.
Later on I want to parse the files, but i want to parse the latest one only.
Is there such option in .net like timestamp in *nix systems?
Any ex...
trying to write an array to a text file, but it is failed, can anybody say, WHY?
$filename= 't12a';
for ($pnum = 1; $pnum <= 15; $pnum++){
$bbal = 3;
$ipmnt = 14 * 5;
$ppmnt = 26 - 7;
$ebal = 48 - 4;
$ccint = 54 + 45;
$cpmnt = 25 + 54...
I take a picture with the camera using
Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
startActivityForResult( intent, 22 );
When the activity completes, I write the bitmap picture out to a PNG file.
java.io.FileOutputStream out = openFileOutput("myfile.png", Context.MODE_PRIVATE);
bmp.compress(...
Hey,
I have this file. It stores a names, a project, the week that they are storing the data for and hours spent on project. here is an example
"James","Project5","15/05/2010","3"
"Matt","Project1","01/05/2010","5"
"Ellie","Project5","24/04/2010","1"
"Ellie","Project2","10/05/2010","3"
"Matt","Project3","03/05/2010","4"
I need to prin...
I know charwise positions of matches like 1 3 7 8. I need to know their corresponding line number.
Example: file.txt
Match: X
Mathes: 1 3 7 8.
Want: 1 2 4 4
$ cat file.txt
X2
X
4
56XX
[Added: does not notice many linewise matches, there is probably easier way to do it with stacks]
$ java testt
1
2
4
$ cat testt.java
imp...
What would be the most performant way to prepend a single character to a multi-gigabyte file (in my practical case, a 40GB file).
There is no limitation on the implementation to do this. Meaning it can be through a tool, a shell script, a program in any programming language, ...
...
Hello all,
Does file_get_contents maintain line breaks? I thought it did but I have tried this:
if($conn){
$tsql = file_get_contents('scripts/CreateTables/SLR05_MATCH_CREATETABLES.sql');
$row = sqlsrv_query($conn, $tsql);
print_r(sqlsrv_errors());
}
The errors I get is that SQL Server complains that there is incorrect...