user513164
user513164

Reputation: 1858

c++ file handling problem

hi everybody out there i need help from u in file handling I'm using Ubuntu as my operating system

now my c++ code has a line remove("/home/manish.yadav/Desktop/ram.txt"); last time i ran this command in C code it remove my operating system

now I'm not sure to use it or not ? can anyone tell me proper syntax of this command so that i can use it in my code ? is there any other way to remove files in c++ by using programs? how to do this? how delete file using c++ program ?

Upvotes: 0

Views: 932

Answers (3)

BЈовић
BЈовић

Reputation: 64203

Take a look into the reference page for std::remove on how to use it to remove files.

Concerning your OS, std::remove doesn't randomly kill OSs. Last time I tried it, the function worked as expected.

Upvotes: 1

chris
chris

Reputation: 91

try it !

unlink("/home/manish.yadav/Desktop/ram.txt");

Upvotes: 2

MSalters
MSalters

Reputation: 179779

"last time i ran this command in C code it remove my operating system".

No, it didn't. Something else did, and we have no crystal ball to guess what that was.

Upvotes: 1

Related Questions