0

Hi,
I have been trying to figure this out:
How do you remove more than one thing like this

remove("C:/Users/"+name+"/Documents/help");

How I want it to work is the users specify's there user name
and then it opens the C drive>Users>Then it needs to add the input user name.

Thanks.

2
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by thines01
-1

Here is a .NET implementation of that:

// KillAFile.cpp : main project file.

#include "stdafx.h"

using namespace System;
using namespace System::IO;

int main(array<System::String ^> ^args)
{
	String^ strUser = "";
	//	 
	do
	{
		Console::WriteLine(L"Enter user ID");
	} while("" == (strUser = Console::ReadLine()));


	File::Delete("C:\\Users\\"+ strUser + "\\Documents\\help");

	return 0;
}
0

Thanks.
This is helpful but do you know how to do this in normal c++ code.
I am not that good with C# yet.

Thanks,
-Kioti16

0

Actually, that's not C#, it's C++ (dot net style).

Here's something older:

#include <stdio.h>
#pragma warning(disable : 4996) /* Microsoft _CRT_SECURE_NO_WARNINGS */
int main(void)
{
	char strUser[128] = {'\0'};
	char strPath[128] = {'\0'};
	
	do
	{
		printf("Enter user ID");
		gets(strUser);
	} while(NULL == strUser[0]);
	
	sprintf(strPath, "c:\\Users\\%s\\Documents\\help", strUser);
	unlink(strPath);
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.