473,322 Members | 1,911 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

HELP!! Library for deleting file not there!

Hello.

I'm developing a Win32 Console Application for a Smart Device (MotoQ).

All i need to do is delete a file with a known name and path. I'm
under the impression that I have to use File::Delete( path ) based on
what MSDN is telling me. Thus I need to include mscorlib.dll ... I
#using this and the method cannot be found. I have tried almost
everything and am completely confused.
#using <C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\msc orlib.dll>

using namespace System;
using namespace System::IO;
#include "stdafx.h"

#include <Tlhelp32.h>
#include <windows.h>
#include <commctrl.h>
void installCab(LPTSTR cabFile);
void installCabs(LPCTSTR directory);
bool checkIfWCELOADIsRunning();
void removeInstallFiles();

void removeInstallFiles()
{
Delete(" ");
}

ERRORS:::

Error 1 error C3861: 'Delete': identifier not found Installer.cpp 64
ANY IDEAS?!?!

thanks, smp

Jul 31 '07 #1
4 1762
sm*****@gmail.com wrote:
Hello.

I'm developing a Win32 Console Application for a Smart Device (MotoQ).

All i need to do is delete a file with a known name and path. I'm
under the impression that I have to use File::Delete( path ) based on
what MSDN is telling me. Thus I need to include mscorlib.dll ... I
#using this and the method cannot be found. I have tried almost
everything and am completely confused.
It looks like you might be mixing managed and unmanaged code in an odd way.

If you're doing Managed code, then you would want call
System::IO::File::Delete, but you're trying to call ::Delete, which doesn't
exist. Given the using directives that you have in force, File::Delete
should be a sufficiently qualified name.

If, on the other hand, you're writing pure native code, just call the
::DeleteFile function from the Win32 API and forget about using the CLR
function to do it.

For that matter, since you're writing in C++, you can simply use
::DeleteFile no matter what - the compiler will "do the right thing" to make
it work from managed or native code.

-cd
Jul 31 '07 #2
On Jul 31, 10:02 am, "Carl Daniel [VC++ MVP]"
<cpdaniel_remove_this_and_nos...@mvps.org.nospamwr ote:
smp9...@gmail.com wrote:
Hello.
I'm developing a Win32 Console Application for a Smart Device (MotoQ).
All i need to do is delete a file with a known name and path. I'm
under the impression that I have to use File::Delete( path ) based on
what MSDN is telling me. Thus I need to include mscorlib.dll ... I
#using this and the method cannot be found. I have tried almost
everything and am completely confused.

It looks like you might be mixing managed and unmanaged code in an odd way.

If you're doing Managed code, then you would want call
System::IO::File::Delete, but you're trying to call ::Delete, which doesn't
exist. Given the using directives that you have in force, File::Delete
should be a sufficiently qualified name.

If, on the other hand, you're writing pure native code, just call the
::DeleteFile function from the Win32 API and forget about using the CLR
function to do it.

For that matter, since you're writing in C++, you can simply use
::DeleteFile no matter what - the compiler will "do the right thing" to make
it work from managed or native code.

-cd
Awesome, that seemed to have worked (::DeleteFile)

Jul 31 '07 #3

"Carl Daniel [VC++ MVP]" <cp*****************************@mvps.org.nospam >
wrote in message news:ej**************@TK2MSFTNGP05.phx.gbl...
sm*****@gmail.com wrote:
>Hello.

I'm developing a Win32 Console Application for a Smart Device (MotoQ).

All i need to do is delete a file with a known name and path. I'm
under the impression that I have to use File::Delete( path ) based on
what MSDN is telling me. Thus I need to include mscorlib.dll ... I
#using this and the method cannot be found. I have tried almost
everything and am completely confused.

It looks like you might be mixing managed and unmanaged code in an odd
way.

If you're doing Managed code, then you would want call
System::IO::File::Delete, but you're trying to call ::Delete, which
doesn't exist. Given the using directives that you have in force,
File::Delete should be a sufficiently qualified name.

If, on the other hand, you're writing pure native code, just call the
::DeleteFile function from the Win32 API and forget about using the CLR
function to do it.

For that matter, since you're writing in C++, you can simply use
::DeleteFile no matter what - the compiler will "do the right thing" to
make it work from managed or native code.
I was under the impression that Smart Device runtime can't do C++ interop
(aka It Just Works), so you need to stick with either purely managed code or
purely unmanaged code, and can't use ::DeleteFile Win32 API function from a
managed assembly (at least, you'd need DllImport attribute and use
p/invoke).
>
-cd

Aug 3 '07 #4
Ben Voigt [C++ MVP] wrote:
I was under the impression that Smart Device runtime can't do C++
interop (aka It Just Works),
I believe you're right - I missed the Smart Device part of the question when
I replied. Mea culpa!

-cd
Aug 7 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: matt | last post by:
I have compiled some code, some written by me, some compiled from various sources online, and basically i've got a very simple flat file photo gallery. An upload form, to upload the photos and give...
1
by: amine | last post by:
Hi, I am trying to develop an app for an IPAQ. the app is basically an ftp client. I have been using the webrequest and webresponse classes to download and upload files which works perfectly...
3
by: Abhas | last post by:
> > Hi, this is Abhas, > > I had made a video library program in C++, but was facing a problem. > > After entering 12 movies, i cannot enter any more movies. > > Something gibberish comes instead....
0
by: Bandit | last post by:
I'm populating a gridview (called docList) with document info from a network folder like so: Sub Show_Files(ByVal inputDir As String) Dim strFileNamePath As String = inputDir Dim dirInfo As...
2
by: Bruce Russell | last post by:
This may sound stupid but I can't rename the WebForm1.aspx in the solution explorer. The file is located in my local web server at C:\Inetpub\wwwroot\Lab3-VB-Starter\WebForm1.aspx Is there...
1
by: Amit D.Shinde | last post by:
I am using kill function to delete the file on disk but it deletes the file permanantly but how to delete the file and send it to recycle bin? Please Reply
6
by: yxq | last post by:
Hello, The File.Delete(VS2005) function can not delete file on Vista-64bit, why? And, what changes of API between 32-bit and 64-bit? Thank you
1
by: diyasher | last post by:
hello my code is in c#. i am using fileSystemWatcher class to watch event when file is deleted. event is fire when file is deleted, i want to stop deleting file, means when user want to delete...
2
by: pandurusankar | last post by:
Hi, Need a pointer for managing File type button in HTML page, i am able to handle all the components in HTML using IEAutomation module like: text box, links, radio button, list box etc. but i...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.