Here is the scenario:
An user have access to two machines
These machines can't communicate with network sockets because of firewall restrictions
But, both have access to a common network share with read/write permissions on a third machine
My question is: is it possible to write a small application executed on both machines that al...
According to the documentation for fgets(), the function takes three parameters:
char * - a string that will hold the input
int - an integer that represents the maximum number of characters to read
FILE * - a FILE * to the stream to read from
I have no trouble calling the function. I just push the three parameters onto the stack, cal...
I have this kind of structure that I want to both read and write to a file, and I want to do it the fastest way possible.
class Map
{
String name;
int tiles[][];
}
What is the best way to do this? I'm a C++ programmer mostly, and I don't know the best way to do this in Java. It seems like it should be really simple, but I don't kn...
How can I request the user to input the filename that my program needs to read from and have it output the name with ".out" instead?
Example:
char fileName[256];
cout << "What is the file name that should be processed?";
cin >> fileName;
inFile.open(fileName);
outFile.open(fileName);
But I need it to save the file as a filename.out ...
I am curious as to how I would go about reading the input from a text file with no set structure (Such as notes or a small report) word by word.
The text for example might be structured like this:
"06/05/1992
Today is a good day;
The worm has turned and the battle was won."
I was thinking maybe getting the line using getline, and then ...
I have been recently involved in handling the console logs for a server and I was wondering, out of curiosity, that is there a performance issue in writing to a large file as compared to small ones.
For instance is it a good idea to keep the log file size small instead of letting them grow bulky, but I was not able to argue much in favo...
I try to write my data to an Excel file. I'm using workbook method SaveAs. This is the code:
string FN = "C:\\Users\\Documents\\dane1.xlsx";
WB.SaveAs(FN, Excel.XlFileFormat.xlWorkbookNormal,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Excel.XlSaveAsAccessMode.xlShared,
Missing.Value, ...
Example from input file:
ARTIST="unknown"
TITLE="Rockabye Baby"
LYRICS="Rockabye baby in the treetops
When the wind blows your cradle will rock
When the bow breaks your cradle will fall
Down will come baby cradle and all
"
The Artist, Title & Lyrics fields have to be extracted to their respective Strings with captalization and format ...
I'm trying to put together a function that receives a file path, identifies what it is, sets the appropriate headers, and serves it just like Apache would.
The reason I am doing this is because I need to use PHP to process some information about the request before serving the file.
Speed is critical
virtual() isn't an option
Must wor...
I notice many applications like firefox allow me to watch part of a video (using VLC) when the file is still downloading. I would like to do that with my application. When i tried opening the video with VLC i get an error.
How do i allow reading when i write to a file? my open line is
File.Open(fn, FileMode.Append)
i do append so i ...
Hi everyone,
I have a configuration file that has variables and value separate by spaces. I want to take the value (in the second column) of certain matches and inline edit the file, dividing this match by 2. I also would like to preserve spacing and use a ceiling function on the value.
For example, the file:
To recap, using an actu...
Hello, once again I ask for help. I haven't coded anything for sometime!
Now I have a text file filled with random gibberish. I already have a basic idea on how I will count the number of occurrences per word.
What really stumps me is how I will determine what line the word is in. Gut instinct tells me to look for the newline character...
I have this code
if filename
begin
if filename == '-'
ARGF.each{|url|
begin
check(url)
rescue Timeout::Error, Errno::ETIMEDOUT
puts "Timeout Error, try again"
redo
end
}
else
File.open(filename) {|file|
file.each{|url|
begin
c...
I'm writing code that check files path calculate hash (SHA1) and copy them.
I made sure that I do not lock them like for example using
public static string SHA1(string filePath)
{
var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
var formatted = string.Empty;
using (var sha1 = new SHA1Managed...
Hi,
I have a small problem. I have a tool which should parse a log file daily, unfortunatetly this log file is in use by the process which writes to the log and I cannot stop it.
First try was to create a copy of the file, which is not working either.
Is there any way for me to read the current text of the log file, even if it is alre...
I have a Sqlite 3 and/or MySQL table named "clients"..
Using python 2.6, How do I create a csv file named Clients100914.csv with headers?
excel dialect...
The Sql execute: select * only gives table data, but I would like complete table with headers.
How do I create a record set to get table headers. The table headers should come dir...
It's been a while since I've done Java I/O, and I'm not aware of the latest "right" ways to work with Zip and GZip files. I don't necessarily need a full working demo - I'm primarily looking for the right interfaces and methods to be using. Yes, I could look up any random tutorial on this, but performance is an issue (these files can get...
I know this is likely to be an open-ended kind of question, but I'll take the best-regarded answers and consolidate them here for reference.
I'm working on a set of tools to read and write Mobipocket files (a.k.a. Kindle eBooks) using C#, and am running into a design question when it comes to writing new files. The underlying file form...
I've been googling around and reading through my book and trying to write out code to read through a text file and process words out of it, one by one, so i can put them in alphabetical order and keep a count of how many words where used and much a word was used. I can't seem to get my GetNextWord() function to work properly and it's dri...
Hi,
I am writing test cases that have to be executed in osgi environment, i have put the test data which is a set of files in the test bundle. I am able to access the test data files using bundle.getResource which returns an URL from which i can get the InputStream for a particular file, but how can i find out all the list of files in a ...