C# :: Mapped Network Drive - Deleting Or Moving A File

Sep 16, 2014

Currently I'm trying to do something extremely basic: delete or move a file

I have a mapped network drive (Y) where I have a file I need to move from one folder to another

First was doing the obvious:

System.IO.File.Move("Y:TempFile.txt", "Y:Temp2File.txt");

Not much to go wrong here, right? As long as I have the correct permission to write in the folders and the folders exists, this would normally go smooth. But for some reason it only copies the file. The source file still exists, but it has successfully copied the file to the destination folder. No exceptions has been thrown or anything... but the file still exists in the source directory

I then changed the code to the following:

System.IO.File.Copy("Y:TempFile.txt", "Y:Temp2File.txt");
System.IO.File.Delete("Y:TempFile.txt");
Console.WriteLine("See mommy, no Exceptions");

As expected the file copies correctly, but the delete command is completely ignored. The file is not deleted, but the Console.WriteLine command is called

I'm running the application as the logged in user. The user has permission to delete the file. If I try from Windows Explorer, the file is correctly deleted. Unfortunately my application refuses to delete the file and even worse, it will not even throw an Exception.

View 10 Replies


ADVERTISEMENT

C# :: Making Moving Button Or Moving Picture Box Clickable?

Jun 13, 2014

i want to make moving button or moving box clickable as i am making a game in which i move picture boxes and user clicks on it and his scores increases. but i was unable to do so , so i tried the same concept with buttons but no results.

View 7 Replies View Related

C# :: Detecting CD-ROM Drive And Grab Filepath Of Only CSV File

Jul 8, 2014

I would like the user to insert a CD into their computer and click on an button on my application that allows them to read the CD-ROM and find a specific file type, e.g. csv, and then grab the info in the csv file.

I already have my StreamReader setup grabbing a filepath.

Now I am just wondering...how do I detect the CD-ROM and how do I grab the filepath of the only CSV file on the CD-ROM?

What's behind detecting a CD-ROM and grabbing a specific file type from a CD-ROM?

I heard about DriveInfo

However, that only allows me to detect a drive but not look at it's contents.

View 14 Replies View Related

C# :: Saving Excel File In D Drive New Folder?

Jul 17, 2014

I am trying to save the excel file in D:/newfolder. but the file saving as newfolderFilename. The newfolder is already created in D drive. File save path i am getting from textbox ....

View 14 Replies View Related

C/C++ :: Read CSV File From Flash Drive (Ubuntu 12.04)

Mar 26, 2013

I want to read a file from my flash drive called text.csv. However, I cannot even open the port where my flash drive is connected. This is the code that I am using, but I get error since the first part. When I run the program it says "fopen Error". I am using Ubuntu 12.04.

#include<stdio.h>
#include<string.h>  
#define SIZE 1
#define NUMELEM 5  
int main(void) {
    FILE* fd = NULL;

[Code] ....

View 1 Replies View Related

C Sharp :: Copying A File From Current Directory To System Drive

Feb 8, 2014

I have tried to use File.Copy and File.Move but non of them would work as I expected .....

View 1 Replies View Related

Visual C++ :: Application Which Print Existing File On Reception Of Network Event

Sep 10, 2014

I basically want to develop an application which print an existing file on reception of a network event (application will be running on a seven 64 bits PC).

I wonder which application type would be the most suitable (and the simplest) for that (console win32, win32 app, MFC app ...). As this application does not need user intervention (print on network event), I'm not sure that I need a MFC application or a win32 app.

View 9 Replies View Related

C++ :: Create A Program That Is Able To Save Database Of Items To File On Hard Drive

Mar 18, 2013

Write a program that is able to save a list of items such as books, CDs, or DVDs and the items that are saved must have attributes associated with them. For example a book has a title, author, publisher, and ISBN.I would like to create a program that is able to save the database of items to a file on the hard drive and also retrieve it from the hard drive.I have this for a start of how to set up a storing program.

#include <iostream>
#include <iomanip>
using namespace std;
int main () {
const int arraySize = 10;
int a[arraySize] = { 2, 6, 4, 10, 12, 89, 68, 45, 37 };
int i, hold;

[code]....

View 2 Replies View Related

C++ :: Partially Mapped Crossover

Aug 7, 2012

Worked with genetic algorithms. im solving travelling salesman problem with genetic algorithm and unfortunately stuck at crossover im using partially mapped cross over. i have tried coding it but it some time does not gives valid tour. Looking for building its logic.

View 1 Replies View Related

C/C++ :: File Pointer Not Moving To The End Of File

Oct 15, 2014

I'm trying to move the File Pointer to the end of the file (check.txt) at line-13. But doesn't matter how many times I run the program out put always comes as

O/P:
Pos=0
Pos=0

#include <iostream>
#include <fstream>
#include <ostream>
using namespace std;
int main () {
streampos size;
char * memblock;

[Code] ....

View 3 Replies View Related

C++ :: Boost Memory Mapped Object

Aug 21, 2014

i've created dll and implemented shared memory that every connected process can use. My problem is that i can't change anything in object, which is stored in the memory.

my class :

class MyClass
{
public:
MyClass();
void test();
int counter;
};
void MyClass::test() {
MessageBoxA(NULL, "test", "test", 0x0000000L);
counter++;
}

in stdafx.h i have :

static offset_ptr<MyClass> offset_mt;
static managed_shared_memory *memSegment;

I initialize shared memory and pointer :

memSegment = new managed_shared_memory(create_only, SHARED_MEMORY_NAME, 4096);
offset_mt = memSegment->construct<MyClass>("MyClass myClass")();

And then in an exported function i call

offset_mt.get()->test();

Im calling this from Java using JNA and result is a memory error (Invalid memory access). However, if I delete 'counter++' from test method, everything works fine - message box appears. Is there a limitation that I cant modify objects inside mapped memory or is this done the other way?

View 3 Replies View Related

C++ :: Iterate Through Container And Find Value Mapped To A Specific Key

Jan 14, 2014

A C++ container type called std::map is used to store elements that are formed by a combination of key value and mapped value. How do you iterate through this container and find the value mapped to a specific key?

View 3 Replies View Related

C++ :: Data Buffer With Memory Mapped Files?

Jan 27, 2014

I have a data buffer project in Windows 7 x64 embedded OS (using Visual Studio 2008), that would work simply like that:

One writer application will send data (no network protocols, just procedure call on the same machine) to my app like 20 packages per second, each data packages will be approximately 3 MB size and comes with a timestamp tag.

My application will store each data item for 100 minutes and then remove. (So I can calculate the total size from beginnig no need for dynamic allocation etc...)

Meanwhile there will be up to 5 reader applications which will query data from my app via Timestamp tag and retreive data (no updates or deletitions on data by reader apps).

So since the data in my buffer app can grow over 50GB I don't think that shared memory is going to work for my case.

I'm thinking about using Boost Memory Mapped Files or Windows API Memory Mapped Files.

So theoratically I will crate a fixed size File on harddisk (lets say 50GB) and then map some portion to RAM write the data to this portion, if the reader applications wants to use the data which is mapped currently on memory, then they will use directly, otherwise they will map some other potion of the file to their address spaces and use from there...

My problem is I haven't use Map File concept at all and I'm not a C++ developer so I'm not very familiar with the language fundementals. I've searched tutorials of boost and msdn for windows as well but there is not too much code example.

So I don't know how to map some portion of the data to memory and manage it, also how to search data in file or memory according to the timestamp tag. Yes there are codes for creating files and mapping the whole file to memory but none for dividing it into regions, aligning or padding the data which I need for my case.

View 2 Replies View Related

C :: Self Deleting Of EXE File By Program Itself

Sep 10, 2014

How to do self deleting of exe file when it is run'd.

View 2 Replies View Related

C++ :: Deleting Records From TXT File

May 8, 2014

Is this the right codes for deleting a recoed on the text file.

void dlte(){
string line, recorddate;
cout << "Please Enter the date of record you want to delete: ";
cin >> recorddate;
ifstream myfile;
ofstream temp;
myfile.open("herald.txt");

[Code] .....

View 1 Replies View Related

C/C++ :: Deleting Certain Lines In Txt File?

Dec 27, 2013

I was assigned to modify Game Lobby code. All the data can be saved in txt file and can be displayed when running the code..How can i remove or delete the certain lines of a txt file when running the cmd?.. I cant program it to be able to delete certain lines but i manage to program to delete the entire data, which is not what i want..

Here's the code so far...

#include <iostream>
#include <fstream>
#include<vector>
#include<cstdio>
#include<iomanip>
#include <string>
using namespace std;
class Player {
public:
Player(const string& name = ""): m_Name(name), m_pNext(0) {}

[Code] ....

View 3 Replies View Related

C++ :: Error In Deleting And Renaming A File In C

Jun 19, 2013

Here is my code i wrote for storing details of my apps.

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct app {
int id;
char name[200];

[Code] ....

View 1 Replies View Related

C++ :: Deleting Certain Bytes From Binary File?

May 26, 2013

How to delete certain bytes from middle of a binary file?

Those bytes are in fact of a struct.

One approach I found was to re-write the whole data except the struct I want to delete. But may be its not good one if file size is in gb and I will have to write complete data again.

View 1 Replies View Related

C :: Reading Matching Strings From A File And Deleting From Another

Sep 26, 2014

We are generating emails for freshman students, however, the system probably due to server overload fails to generate some emails. So I'm working on this c code( probably was a wrong choice) to search for regexp matching the generated emails and deleting from the list of students and propective emails.

I"m currently at the stage of making sure the code can find all the matching regexp from the student list file before deleting! But the code fails to read all matching regexp?

Code:
//Filename: SearchReplace.c
//Usage: This searches for lines in a file containing a particular work and deletes the lines.
//Licence: GNU P.L.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

[code] .....

What I'm missing. It recognizes some regexp and fails to recognise some. Been staring for hours!

View 4 Replies View Related

C++ :: Deleting Repeated Lines In A Text File

Jul 30, 2014

I have a text file with repeated lines, and i would like to get rid of the duplicate information, an algorithm to achieve this?

Example of my text file (the actual file may be huge, up to 500MB):

+Hello
+Bye
*The sun
-The moon
+Bye
/One coin
+Bye
+Bye
+Hello
*The sun

And i would expect to get something like this:

+Hello
+Bye
*The sun
-The moon
/One coin

I know how to open and read a file with fstream and getline(), but i don't know how to make the comparison.

View 6 Replies View Related

C :: Array Of Structs (adding / Deleting Elements To A File)

Sep 20, 2013

I want to write a program to record my neighborhoods's name and address by using an array of structs and file.

my array of structs is

Code:
#define SIZE 30
typedef struct{
char name[30];
char address[100];
}Detail;
Detail neighbor[SIZE];

And I want to make adding,deleting, and searching functions.Something like

Code:

void add();//Add name and address to a file,
//and add more to the same file if I want to.
void del();//Delete or Change some neighbor's name or address
//in the same file(Can I?)
void search();//Search name and show detail

So I started to code adding function first, but I don't know that I need to use pointer to code each functions relations, and I don't know how to check that my input's already exists yet. But I started some code below...

Code:
void add() {
int i=0;
FILE *fp = fopen("neighborhood.txt", "at");
if ( fp != NULL ) {
do{

[Code]......

View 8 Replies View Related

C++ :: Method To Loop Through Network IPs

Nov 25, 2013

This problem relates to a program i am developing to ping all hosts on a network.

So far I've managed to access a PostgreSQL database to retrieve a CIDR network address e.g. 192.168.52.14/24.

I have then managed to mask the bits to get the network address.
So for e.g. above its 192.168.52.0

I now need some kind of algorithm to loop through available hosts so from.

192.168.52.0 - 192.168.52.255

I have got as far as deriving the network and separating it into an int array

So I have : ip_start[]= {192,168,52,0}

View 1 Replies View Related

C++ :: Threading Over The Network With Pthread Or TBB?

Jun 13, 2013

I'm wondering if there is a library for C++ that supports threading over the network, maybe with a threading pool and a specific protocol; or if there is just a de-facto protocol for doing threading over the network.

View 10 Replies View Related

C# :: Using Linq To Get DriveInfo Of ONE Drive

Jul 23, 2014

I want some simple code which will return only the DriveInfo from one drive. I have the below code but it isn't displaying what I expect it to display, I have a feeling i'm using Linq wrong!

var dname = from n in System.IO.DriveInfo.GetDrives() where n.Name == "F" select n.VolumeLabel;
richTextBox2.AppendText(dname.ToString() + "
");

The above should return the devices VolumeLabel which is in port F.

Instead I get the following:

System.Linq.Enumerable+WhereSelectArrayIterator`2[System.IO.DriveInfo,System.String]

View 5 Replies View Related

C++ :: Presence Of A Folder In A Drive?

Dec 15, 2012

using C++ how can i check the presence of a folder in a drive.

The path of the folder is available in a std::string like std::string path = "C:TestFolder";

View 3 Replies View Related

C++ :: Change Network Configuration Using Win32 VC++

Feb 28, 2013

I want to change my system IP, subnet mask, host name etc. using win32 VC++.

I've tried AddIPAddress function but that's not persistent.

I want to change it that it should be change without rebooting system and should be there after restarting the system.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved