Hello!
I have a problem that I want to insert and delete some chars in the middle of a file. fopen() and fdopen() just allow to append at the end.
Is there any simple method or existing library that allow these actions? Thanks in advance.
...
On my site a user may upload a file (pic, zip, audio, video, whatever). He then may decide to replace it with a newer revision. This user may upload a file, make a post then decide to put up a new revision replacing the old (lets say its a large zip or tar.gz file). Theres a good chance people may be downloading it if he sent out an emai...
Please see this piece of code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main() {
int i = 0;
FILE *fp;
for(i = 0; i < 100; i++) {
fp = fopen("/*what should go here??*/","w");
//I need to create files with names: file0.txt, file1.txt, file2.txt etc
//i.e. file{i}.txt
}
}
...
So I'm writing a Java application that uses Simple to store data as xml file, but it is hellishly slow with big files when it stores on a network drive compared to on a local hard drive. So I'd like to store it locally before copying it over to the desired destination.
Is there some smart way to find a temporary local file storage in Ja...
Please see code snippet:
File[] additionalFiles = new File(FILE_PATH).listFiles();
boolean isDirectory = file.isDirectory();
I have verified that the directory path is correct, and when I run the code on Windows, the value of isDirectory is true (as it should be). Any suggestions as to why this occurs on Linux (RedHat Enterprise Linu...
Hi all,
I would like to know how to efficiently implement filesystem changes in java? Say I got a file in a folder and modify that file. I would like to be notified by java about this change as soon as possible(no frequently polling if possible.).
Because I think I could call java.io.file.lastModified every few seconds but I don't lik...
Is it possible to open and read from a text file in a MYSQL stored procedure? I have a text file with a list of about 50k telephone numbers, and want to write a stored procedure that will open the file, read the 50k lines and store it as rows in a table. I cannot load the file directly using LOAD IN FILE as the table has additional colum...
I need effective algorithm to keep only ten latest files on disk in particular folder to support some kind of publishing process. Only 10 files should present in this folder at any point of time. Please, give your advises what should be used here.
...
how can I write and read files in JavaScript?
Is it possible?
...
I'm trying to write a file from an Http post reply to a file on the sdcard.
Everything works fine until the byte array of data is retrieved.
I've tried setting WRITE_EXTERNAL_STORAGE permission in the manifest
and tried many different combinations of tutorials I found on the net.
All I could find was using the openFileOutput("",MODE_WO...
log file1 contains records of customers(name,id,date) who visited yesterday
log file2 contains records of customers(name,id,date) who visited today
How would you display customers who visited yesterday but not today?
Constraint is: Don't use auxiliary data structure because file contains millions of records. [So, no hashes]
Is there a...
Is there a way to abort a python write operation in such a way that the OS doesn't feel it's necessary to flush the unwritten data to the disc?
I'm writing data to a USB device, typically many megabytes. I'm using 4096 bytes as my block size on the write, but it appears that Linux caches up a bunch of data early on, and write it out to ...
I'm having a problem getting a program to read from a file based on a template, for example:
bool parse(basic_ifstream<T> &file)
{
T ch;
locale loc = file.getloc();
basic_string<T> buf;
file.unsetf(ios_base::skipws);
if (file.is_open())
{
while (file >> ch)
{
if(isalnum(ch, loc))
...
Hello Stack Overflow friends. I have a simple problem which i fear doesnt have a simple solution and i need advice as to how to proceed. I am developing a java application packaged as and executable JAR but it requires to modify some of its JAR file contents during execution. At this stage i hit a problem because some OS lock the file...
What is the most memory efficient way to remove duplicate lines in a large text file using C++?
Let me clarify, I'm not asking for code, just the best method. The duplicate lines are not guaranteed to be adjacent. I realize that an approach optimized for minimal memory usage would result in slower speeds however this is my restriction...
I'm trying to build an application that builds a resource file into a jar, but I'd like to have the project runnable within eclipse. I have a basic maven 2 structure for my project, and I'm unsure how to read in the file such that it's found and used when run from the JAR or from within eclipse. Thought?
Structure:
src/main/java
src/ma...
Hi there,
I need to read a textfile and store the data into a Safearray.
I tried it with this function:
bool Parse::LoadTxtFileIntoSafearray(string* strPath, SAFEARRAY** pByteArray)
{
bool bReturn = false;
string line;
int iOffset = 0;
char* pcBuffer = NULL;
std::ifstream infile ( strPath->data() );
if ( !infile.fail() )
{
infil...
For some graphics work I need to read in a large amount of data as quickly as possible and would ideally like to directly read and write the data structures to disk. Basically I have a load of 3d models in various file formats which take too long to load so I want to write them out in their "prepared" format as a cache that will load muc...
In the R scripting language, how do I write lines of text, e.g. the following two lines
Hello
World
to a file named "output.txt"?
...
Ok, so I'm trying to delete lines from a text file with java. Currently the way I'm doing this, is I'm keep track of a line number and inputting an index. The index is the line I want deleted. So each time I read a new line of data I increment the line count. Now when I reach the line count that is the same index, I dont write the data t...