Say I have a file with the format:
key1/value1
key2/value2
key3/value3
....
Say I have an array to hold these values:
char *data[10][10]
How would I read this file and get key1, key2, and key3 into data[0][0], data[1][0], and data[2][0]. Then put value1, value2, and value3 into data[0][1], data[2][1], and data[3][1]. So actually I ...
I'm developing a simple Text Editor to understand better PocketC language, then I've done this:
#include "\\Storage Card\\My Documents\\PocketC\\Parrot\\defines.pc"
int filehandle;
int file_len;
string file_mode;
initComponents()
{
createctrl("EDIT", "test", 2, 1, 0, 24, 70, 25, TEXTBOX);
wndshow(TEXTBOX, SW_SHOW);
guigetf...
I'm playing a little bit with PocketC by doing a simple text editor. But with this code to read and to display the contents of the file on the EDIT control:
int filehandle;
int file_len;
string file_mode;
initComponents()
{
createctrl("EDIT", "test", 2, 1, 0, 24, 70, 25, TEXTBOX);
wndshow(TEXTBOX, SW_SHOW);
guigetfocus();
}...
Here's what I'm doing (sorry for the variable names, I'm not using those in my code):
File.open("out_file_1.txt", "w") do |out_1|
File.open("out_file_2.txt", "w") do |out_2|
File.open_and_process("in_file_1.txt", "r") do |in_1|
File.open_and_process("in_file_2.txt", "r") do |in_2|
while line_1 = in_1.gets do
...
What should be the ideal number of parallel java threads for copying a large set of files from a quad core linux box to an external shared folder? I can see that with a single thread it is taking a hell lot of time to move the files one by one. Multiple threads is improving the copy performance, but I don't know what should be the exact ...
Hello,
I'm writing several C programs for an embedded system where every bit of performance we can squeeze out will matter. Part of that is accessing log files. When determining if a file exists, is there any performance difference between using open / fopen, and stat ? I've been using stat on the assumption that it only has to do a q...
I'm porting to Android. My existing project has a ton of resource files that I'm porting into my Android project. I have them all in /res/raw/, and I would like to access those resources in my native library with functions such as fopen() and such. Can this be done, or do I have to go through JNI for this as well? I would really pref...
Wondering if one file is open for writing in and another programe is accessing it recursively in tcl.
...
I need to get all those files under D:\dic and loop over them to further process individually.
Does MATLAB support this kind of operations?
It can be done in other scripts like PHP,Python...
...
I need to open a file using c shell. The file contains a single integer, and I need to put it into a variable, increase it and put back into the file. Meaning, if the file contains the number 5, I need, after the program runs, that the file contains the number 6. Any suggestions?
...
Hi everybody.
I try to read some file with google's GDownloadUrl and it works only from time to time.
failure means fileRows == "blah blah"
success means fileRows == (real file content)
I've noticed, however, that when I cease (with Firebug) the execution on line 3 for a couple of seconds, it succeeds more often. Maybe it is some kin...
So I'm running through a list of things and have code that creates an .xml files with IO::File called $doc, then I make a new writer with XML::Writer(OUTPUT => $doc). More code runs and I build a big XML file with XML::Writer. Then, near the end of the file, I find out if I need this file at all. If I do need it, I just:
$writer->end()...
Hi,
I've got a service which runs all the time and also keeps a log file. It basically adds new lines to the log file every few seconds. I'm written a small file which reads these lines and then parses them to various actions. The question I have is how can I delete the lines which I have already parsed from the log file without disrupt...
How to read from a file array of numbers? I mean, how to read chars from a file?
sorry for bad eng.
upd: yes, i can :)
just: "1 2 3 4 5 6 7 8" and etc. I just do not know how to read chars from a file.
...
this code is the base of lexer , and it does the basic operation of removing the whitespaces from a source file and rewrites it into another file with each word in separate lines .
But i am not able to understand why the file lext.txt not getting updated?
#include<stdio.h>
/* this is a lexer which recognizes constants , variables ,sym...
I have several scripts that take as input a directory name, and my program creates files in those directories. Sometimes I want to take the basename of a directory given to the program and use it to make various files in the directory. For example,
# directory name given by user via command-line
output_dir = "..." # obtained by OptPars...
Possible Duplicate:
Parsing text in C
Say I have written to a text file in this format:
key1/value1
key2/value2
akey/withavalue
anotherkey/withanothervalue
I have a linked list like:
struct Node
{
char *key;
char *value;
struct Node *next;
};
to hold the values. How would I read key1 and value1? I was thinkin...
Hi,
I know I can do this,
------
open(F,">",\$var);
print F "something cool";
close(F);
print $var;
------
or this,
open(F, "| ./prog1 | ./prog2 > tmp.file");
print F "something cool";
close(F);
but is it possible to combine these? The semantics of what I'd like to do should be clear from the following,
open(F,"|./prog...
We have a situation where our application needs to process a series of files and rather than perform this function synchronously, we would like to employ multi-threading to have the workload split amongst different threads.
Each item of work is:
1. Open a file for read only
2. Process the data in the file
3. Write the processed data to ...
I have a license file that I need to access at runtime in order to create pdf-files. After I have created the in memory pdf, I need to call a method on that pdf to set the license, like this:
pdf.SetLicense("pathToLicenseFileHere");
The license file is located in the same project as the.cs-file that creates the pdf, but is in a separa...