Tag:File operation

  • File operation of Perl learning notes

    Time:2021-11-24

    Perl’s operation on files is similar to other languages, that is, the operation of opening, reading and writing. 1. Open the file ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 #! c:/perl/bin/perl -w use utf8; use strict; use warnings;   my $filename = ‘test.txt’; #Or use an […]

  • Lua file operation details

    Time:2021-10-31

    I / O libraries provide two different ways to process files: IO table calling method Using the IO table, IO. Open will return the description of the specified file, and all operations will be described around this file. The IO table also provides three predefined file descriptions: io.stdin, io.stdout, and io.stderr File handle direct call […]

  • Explain the file operation methods in Python

    Time:2021-9-27

    1: Open mode of file After understanding the character encoding, we all know that files are encoded into binary in a certain standard and stored in the hard disk. In the default opening mode of the file, f = open (‘a.txt ‘,’ RT ‘, encoding =’utf-8’), where t means that the file is opened in […]

  • ASP.NET Core 2.0 local file operation problems and Solutions

    Time:2020-11-19

    problem How to ASP.NET Limited access to local directory and file information in core 2.0? answer Create an empty project, modify the startup class, and add the services needed to access local files public void ConfigureServices(IServiceCollection services) { services.AddSingleton<IFileProvider>( new PhysicalFileProvider(Directory.GetCurrentDirectory())); } Create a middleware, read all the files in the root directory, and output […]

  • Native JS realizes the instance method of file upload, download and encapsulation

    Time:2020-11-11

    1、 Download 1. Code Const filedownloadclick = (obj) = > {// resolve compatibility if( document.all ){ obj.click(); } else { let event = document.createEvent(“MouseEvents”); event.initEvent(‘click’, true, true); obj.dispatchEvent(event); } } Const FileDownLoad = (RES, obj) = > {// download /* obj :{ Username downloaded by Weekly time download time Weekly type download type } */ […]

  • Summary of common file operation in JSP

    Time:2020-7-10

    This paper summarizes the common file operation of JSP. Share with you for your reference. The details are as follows: File operation in jsp: file class String path= request.getRealPath (“/”); // pass the parameter ‘/ “to return to the root directory of the web application String tmp_path=path+”tmp”; File f1=new File(tmp_ Path); // create a file […]

  • Using go language to transfer files remotely

    Time:2020-5-27

    preface There was a previous article about how to use the go language to execute remote commands through SSH protocol: how to use the go language to implement remote command execution is the same as SSH protocol can also use the go language to transmit files remotely. In addition to the SSH Library, in order […]

  • Summary of VBScript file operation code

    Time:2020-3-5

    Create text file Copy codeThe code is as follows: Set objFSO = CreateObject(“Scripting.FileSystemObject”) Set objFile = objFSO.CreateTextFile(“C:\FSO\ScriptLog.txt”) Whether the procuratorial documents exist Copy codeThe code is as follows: Set objFSO = CreateObject(“Scripting.FileSystemObject”) If objFSO.FileExists(“C:\FSO\ScriptLog.txt”) Then Set objFolder = objFSO.GetFile(“C:\FSO\ScriptLog.txt”) Else Wscript.Echo “File does not exist.” End If Delete text file Copy codeThe code is as […]

  • Analysis of writing strings and arrays to PHP files

    Time:2020-2-4

    The example of this article describes the method of writing string and array to PHP files. To share with you for your reference, as follows: Scenario 1: use text documents to record some operation logs, because for some frequent operations, the amount of data recorded by operation is bound to be large, and using database […]

  • Summary of some common file operation methods in Ruby

    Time:2019-12-11

    You need to learn a lot when you start learning ruby. Now you start to use ruby to write a script, which uses a lot of file related operations. Here, I will sort out some of them in stages. Easy to find again. Does the file or directory exist Copy codeThe code is as follows: […]

  • Implementation of File Operation and Network Request in Scala

    Time:2019-10-8

    1. Read data for each line in the file def main(args: Array[String]): Unit = { // pay attention to the encoding format of the file. If the encoding format is not correct, read the wrong report. val file: BufferedSource = Source.fromFile(“F:\\files\\file.txt”,”GBK”); val lines: Iterator[String] = file.getLines() for(line <- lines){ println(line) } // Pay attention to […]

  • MFC file operation method for creating files of CFile class

    Time:2019-9-29

    MFC file operation class CFile Several constructors of CFile class CFile (); // Constructor with no parameters. CFile (int hFile); // Constructor with file handle parameters. CFile( LPCTSTR lpszFileName, // File Path to Open UINT nOpenFlage//Sharing and Access Mode when Opening Files ) Constructor with file path and open mode In addition to opening a […]