overwrite

What's the best way to reset a char[] in C?

I use a string: char word[100]; I add some chars to each position starting at 0. But then I need be able to clear all those positions so that I can start add new characters starting at 0. If I don't do that then if the second string is shorten then the first one I end up having extra characters from the first string when adding th...

How do I modify the internal buffer of std::cin

Hello, I am writing a software that grabs a password using std::cin However unlikely, i am trying to avoid the possibility that the password get paged to the disk from memory so I want to modify the buffer of std::cin to overwrite the password as soon as I'm done with it. right now i have this: std::cin.clear(); std::stringstream ss;...

How can I overwrite the contents of an SQLite file

I've just started using SQLite and I want to write all my application data to a file, not knowing if the file exists already; with 'normal' files, this is straightforward, but with SQLite I can't create a table if it already exists, and I can't insert a row if the primary key already exists. I basically want to do something like "CREATE...

Force derived class to call base function

If I derive a class from another one and overwrite a function, I can call the base function by calling Base::myFunction() inside the implementation of myFunc in the derived class. However- is there a way to define in my Base class that the base function is called in any case, also without having it called explicitly in the overwritten f...

Overwriting, Saving, Using Stream. Are they really different?

I want to make a file unusable. Does it really make sense if i overwrite it? Is there a difference between overwriting, Using stream , Saving or using text append? Note: I want to delete the file afterwards and avoid recovery. ...

Read and overwrite a file in Python

Currently I'm using this: f = open(filename, 'r+') text = f.read() text = re.sub('foobar', 'bar', text) f.seek(0) f.write(text) f.close() But the problem is that the old file is larger than the new file. So I end up with a new file that has a part of the old file on the end of it. ...

php + upload.class + not overwriting the image

Hi, i am trying to upload a file with upload.class and i need to overwrite the file when the user upload a new one. But instead of overwriting, he is putting photo_01, photo_02, etc... The code: $foto = new Upload($_FILES['photo']); $fotot = new Upload($_FILES['photo']); $fotot->image_resize = true; $fot...

g_tree_insert overwrites all data

I wonder how I should use the GTree (from GLib) to store data? Every new value I insert into GTree with g_tree_insert routine is overwrite the previous one! GTree *tree; //init tree = g_tree_new( g_str_equal ); //"g_str_equal" is a GLib default compare func //... for( i = 0; i < 100; ++i ) g_tree_insert( tree, random_key(), random_v...

Overwriting lines in file in C

Hi, I'm doing a project on filesystems on a university operating systems course, my C program should simulate a simple filesystem in a human-readable file, so the file should be based on lines, a line will be a "sector". I've learned, that lines must be of the same length to be overwritten, so I'll pad them with ascii zeroes till the en...

How do I overwrite X bytes on offset Y with fwrite()?

Hi, All I can find using fopen() and fwrite() in C is to delete all contents and start writing again or append to the end of the file. What if I need to go to some offset in the file and overwrite a few bytes? Is that possible with some function? ...

Overwriting a core Wordpress function - should work but it doesn't

I'm trying to overwrite a core Wordpress function (found in media.php) using add_filter() in my theme's functions.php file. This should work accord to the blogs that I've come across, but for some reason I see no change whatsoever. #override what WP is trying to do to scaling images by default function my_image_hwstring($width, $height)...

How do I overwrite a file currently being read by Python

Hi guys, I am not too sure the best way to word this, but what I want to do, is read a pdf file, make various modifications, and save the modified pdf over the original file. As of now, I am able to save the modified pdf to a separate file, but I am looking to replace the original, not create a new file. Here is my current code: from...

Problem with WiX major upgrade!

The Problem: I need both these files, PathwaysMDF and PathwaysLDF to replace (overwrite) the old copies on a major upgrade. Okay, this WiX is driving me crazy. The settings file works perfectly, however the database files are still not working! I have tried several approaches... Here is the code attempting this with the registry key...

Visual Studio 2008 patching without suppressing database

Hi, I made a program using visual c# which connects to a local .mdf sql database. I've published it using the Publish Wizard, used the files on another computer to install it and it worked fine. However, some bugs were discovered. I've corrected the problems, published it again and tried to patch the program on the 2nd computer. Aft...

WCF web.config is getting overwritten after every compilation?

Hi I have a Silverlight application calling a WCF service. SimplehttpBinding stuff. Every I make changes to silverlight xaml code, the web.config gets refrshed also. Even if make any changes to web.cofig file, they get overwritten too. Its as if, some other process is writing these files. Why is that happening? How can I make sure t...

django forms overwrite data when saved

If a have a form, with the data from a user, let's say a CV, and i save the data from the form into a database, but i don't want that a CV from the same user to be stored in the database more than once(when edited form instance) I want it to be overwritten every time it is saved by one same user. How can i do it? thanks a lot ...

JQuery selfbuild plugin question - default value is overwritten.

Hi jQuery ninjas. I need your help. I have made a really clean and simple example to illustrate my problem. I have build my own jquery plugin: (function($) { $.fn.setColorTest = function(options) { options = $.extend($.fn.setColorTest.defaults,options); return this.each(function() { $(this).css({ 'color': options.color}...

problems with extended classes and overwrite with methods

I have a .net website written in C# and will make functionalities that other developers can use. So I will make some default implementation and a developer can overwrite some methods Example: i have a class ShoppingCart and a class Product the class product haves a method getProductPrice the shoppingcart will call the method getProductP...

Overwrite file using append mode for fopen

I am using fopen to write to a binary file and using the cstdio (stdio.h) library due to legacy code and it must be cross-platform compatible with Windows and Linux. For the prototype, FILE * fopen ( const char * filename, const char * mode );, I am using const char * mode = "ab", which will append to a binary file. Writing operations ...

Amazon S3 Browser Based Upload - Prevent Overwrites

We are using Amazon S3 for images on our website and users upload the images/files directly to S3 through our website. In our policy file we ensure it "begins-with" "upload/". Anyone is able to see the full urls of these images since they are publicly readable images after they are uploaded. Could a hacker come in and use the policy d...