当前位置:网站首页>Go breakpoint continuation
Go breakpoint continuation
2022-06-24 06:41:00 【Give me a bottle of ice cream】
package main
import (
"fmt"
"os"
"strconv"
"io"
)
func main() {
// File directory
srcFile:="E:\\ Enterprise level Four layer load balancing lVS\\L100 - Enterprise level open source four layer load balancing solution -LVS( Full version ) - 199 element \\ The first 1 Chapter Course introduction \\1-1 LVS Learning guide video .mp4"
// replica catalog
destFile:="E:\\cpoy\\LVS Chapter one .mp4"
// Temporary directory
tempFile:=destFile+"temp.txt"
file1,_:=os.Open(srcFile)
file2,_:=os.OpenFile(destFile,os.O_CREATE|os.O_WRONLY,os.ModePerm)
file3,_:=os.OpenFile(tempFile,os.O_CREATE|os.O_RDWR,os.ModePerm)
defer file1.Close()
defer file2.Close()
//1. Read the data in the temporary file , according to seek
// Seek Set file pointer offset
file3.Seek(0,io.SeekStart)
bs:=make([]byte,100,100)
// read Read len(bs) byte
n1,err:=file3.Read(bs)
fmt.Printf(" Read byte size %v\n",n1)
countStr:=string(bs[:n1])
fmt.Printf(" Convert to string %v\n",countStr)
//count,_:=strconv.Atoi(countStr)
count,_:=strconv.ParseInt(countStr,10,64)
fmt.Printf(" Convert to INT64%v\n",count)
//2. Set read , Write offset
file1.Seek(count,0)
file2.Seek(count,0)
data:=make([]byte,1024,1024)
n2:=-1// Amount of data read
n3:=-1// Amount of data written
total :=int(count)// Total number of reads
for{
//3. Reading data
n2,err=file1.Read(data)
if err ==io.EOF{
fmt.Println(" File copy complete ..")
file3.Close()
os.Remove(tempFile)
break
}
// Write data to the target file
n3,_=file2.Write(data[:n2])
total += n3
// The total number of copies , Store in a temporary file
file3.Seek(0,io.SeekStart)
file3.WriteString(strconv.Itoa(total))
// Fake power failure
if total>8000000{
panic(" Pretend to be out of power ..., Pretend ...")
}
}
}
边栏推荐
- Provide SFTP connection for Amazon S3
- Wordpress5.8 is coming, and the updated website is faster!
- Record of waic 2021 round table conference 𞓜 cross border dialogue: current situation and future of AI and sustainable development
- Innovating the security service mode, deeply convinced that the organization has been equipped with a "continuous online expert group"
- Record -- about the problem of garbled code when JSP foreground passes parameters to the background
- leetcode:1856. 子数组最小乘积的最大值
- Coding platform project construction guide
- Five minute run through 3D map demo
- The installation method of apache+mysql+php running environment under Windows
- leetcode:84. 柱状图中最大的矩形
猜你喜欢

Manual for automatic testing and learning of anti stepping pits, one for each tester

leetcode:剑指 Offer 26:判断t1中是否含有t2的全部拓扑结构

Leetcode: Sword finger offer 26: judge whether T1 contains all topologies of T2

创客教育给教师发展带来的挑战

leetcode:85. Max rectangle

【二叉数学习】—— 树的介绍

缓存操作rockscache原理图

Record -- about the problem of garbled code when JSP foreground passes parameters to the background

leetcode:1856. 子数组最小乘积的最大值

基于三维GIS系统的智慧水库管理应用
随机推荐
Surveying and mapping principle of GIS coordinate system: geoid / datum / reference ellipsoid /epsg/sri/wkt
Raspberry PI (bullseye) replacement method of Alibaba cloud source
线程安全与实现方法
Actual combat | how to deploy flask project using wechat cloud hosting
leetcode:剑指 Offer 26:判断t1中是否含有t2的全部拓扑结构
程序员使用个性壁纸
What is the domain name query network and how it should be used
When easynvs is deployed on the project site, easynvr cannot view the corresponding channel. Troubleshooting
typescript vscode /bin/sh: ts-node: command not found
Kubernets traifik proxy WS WSS application
What is a secondary domain name primary domain name how to apply for a secondary domain name
Cloud native high availability and Disaster Recovery Series (I): pod break up scheduling
WordPress applet build applet from zero to one [server configuration]
About Stacked Generalization
Come on, it's not easy for big factories to do projects!
How does go limit the flow of services?
Why computers often crash
leetcode:85. Max rectangle
leetcode:85. 最大矩形
Replacing human eyes -- visual inspection technology