sourcemod icon indicating copy to clipboard operation
sourcemod copied to clipboard

Implement File.Copy

Open dragokas opened this issue 3 years ago • 2 comments

To copy file from one place to another. Something like:

bool CopyFile(char[] SourceFile, char[] TargetFile)
{
	Handle hr = OpenFile(SourceFile, "rb", false);	
	if( hr )
	{
		Handle hw = OpenFile(TargetFile, "wb", false);	
		if( hw )
		{
			int bytesRead, buff[64];
			
			while( !IsEndOfFile(hr) )
			{
				bytesRead = ReadFile(hr, buff, sizeof(buff), 1);
				WriteFile(hw, buff, bytesRead, 1);
			}
			delete hw;
		}
		delete hr;
	}
}

dragokas avatar Jan 01 '22 14:01 dragokas

Perfect

Smesh292 avatar Feb 10 '22 18:02 Smesh292

Thanks

NullifidianSF avatar Aug 22 '22 20:08 NullifidianSF