write

Only disk writes but iotop shows reads as well

Hi, I'd like to understand the following issue: A process is doing write sys call only, in an infinite loop. When I bring up iotop I would expect to see non-zero write speed and zeroed read speed related to that process. But iotop tells read and write can be equal (depending on single write size). Have a look at the C code: #include <...

java hashmap query

Hi guys, Im reading values from a file and storing these values in a hashmap, using a bufferedreader, in the following manner -- while((String str=buffread.readLine()).length()>1) { hashMap.put(str.substring(0,5),str); } I can also verify that the hashmap has all data that was initially presen...

Reading from a file in assembly

I'm trying to learn assembly -- x86 in a Linux environment. The most useful tutorial I can find is Writing A Useful Program With NASM. The task I'm setting myself is simple: read a file and write it to stdout. This is what I have: section .text ; declaring our .text segment global _start ; telling where pr...

writing a ".rtest" output to file, using the R program (ex) via write.table?

Hi all, I am using R to open up some saved .csv files in a particular pairwise manner and perform a statistical test ("mantel.rtest", found in the package "ade4"). The .csv files are sequentially named as either "fileAX" or "fileBY", where X and Y are integers. I'd like to save the results of this test in a single file, but am runnin...

Uninterruptible read/write calls

At some point during my C programming adventures on Linux, I encountered flags (possibly ioctl/fcntl?), that make reads and writes on a file descriptor uninterruptible. Unfortunately I cannot recall how to do this, or where I read it. Can anyone shed some light? Update0 To refine my query, I'm after the same blocking and guarantees th...

file operation write is not happening in new line

Hi following code sample seems to have some problem or either it has to do something with OS internals. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> static void usage(); #define MONC_AM_CONF "/tmp/monc.c...

built predicate into prolog

input = * value = 3 output = ***(3 star) use prolog to write out the coding when key in value is 3 than the output is ***(3star) or when key in value is 5 than output is *****(5 star). so i want to ask what are the coding in prolog for this question. my answer is like below but cannot compile and have error. can check for me?? start...

best way to update congfig.php

I have a config.php file for one of my site which holds information needed to run the site. It somewhat looks like this: <?php $site_name="The Site"; $base_url = "http://site.com"; $upload_path = "/images"; ?> Getting the values from that is easy, I just use require 'config.php'; but how can i give an option to add this from a html ...

Writing binary files C++, way to force something to be at byte 18?

I'm currently trying to write a .bmp file in C++ and for the most part it works, there is however, just one issue. When I start trying to save images with different widths and heights everything goes askew and I'm struggling to solve it, so is there any way to force something to write to a specific byte (adding padding in between it and ...

Creating executable scripts with PHP

I'm building a module for a CMS that creates its own PHP files. I've received some feedback that a lot of hosting providers don't allow PHP to have write permissions on directories where PHP scripts can be executed. Although the scripts are not technically "executable" (they're just class definitions), I'm concerned that this module may ...

Writing binary file in C++, unsigned char is too small but other data types add padding, is there an alternative?

I'm trying to write a .bmp in C++ but unsigned char can't hold a value high enough for my needs and other data types add padding because of specific byte alignment that makes a mess of things. So is there an alternative data type that can hold a higher value that won't add padding (or a way to make unsigned char hold a higher value)? ...

SAving pictures which needed by my application

Hi, My app needs to download picture from internet time to time and store them to show when it runs according to the selection. how can i download the pictures and what is the way to store them in my application folder or etc. i m trying to use file output stream on application local folders such as assets and drawable but so far no luck...

Scripting.FileSystemObject Write method fails

So in my program I'm using COM Auotmation (AutomationFactory in Silverlight 4) to create a FileSystemObject, to which I write a string (theContent). theContent in this case is a small UTF-8 XML file, which I serialized using MemoryStream into the string. The string is fine, but for some reason whenever I call the FileSystemObject's W...

What is the best way to create an rw pipe with c++?

I have a program A that needs to send commands to the stdin of a program B and reads back the output of this program B. (Programming in C++, not linux only) ProgramA -> send letter A -> ProgramB ProgramA <- output of B <- ProgramB I actually have the first part, send commands to B, working with popen(). I do know that popen is a one wa...

C# Write Resource from Download

Alright, so I have been wondering how to do this for a while. Basically, what I want to do is instead of downloading a file directly to the hard drive can I make my application "download it to resources" I need to Download the file or bytes, and write it to resources. Using a method like this to download byte[] example; ...

Pass pointer to guaranteed zeroed memory

I need to zero records of varying sizes in a file. To do this, I'm currently allocating dummy records, memseting them to zero, and passing these to a write function. Is there some region which is guaranteed to always be zeroed (and of a large enough size), that I can instead point to, removing the need for repeated allocation and zeroin...

IE reading/writing on client end

Hi Everyone, Is there a way to read and write files on a client's computer using a web based application? Basically I need to create a internal app that will take two input CSV files and convert it into an output CSV file that is written to the same location as the input files on the client's computers. Since this is an internal app, I...

I have a series of python modules I would like to put into a package, how can I do this?

I have a series of python modules I would like to put into a package. I would like to set it up such that anyone interested can just download it and install it (on unix). How can I do this? ...

Question about libc_write()

I'm trying to determine what libc_write does exactly. I'm executing a binary on a processor simulator I designed in c++ and the program being run has jumped to the function call libc_write(). Now, there are 2 different types of write functions - write() which writes one large buffer to a stream, possibly comprised of many buffers that ...

Forcing closed an open file by C#

I found a similar question here but it was closed/accepted with an answer of "don't do that". I'm in a situation where I don't care what happens to the other applications, I want to take a file that may be locked by others (rudely if needed) and have my way with it. I may need to move, rename, or delete this file. Basically I need to ...