c++ ifstream函数的使用
word中最大的字号是多少
Word中最大字号是300,设置word特大号字体的方法:1、新建一个word文档,进入文字编辑页面。2、在文字编辑界面,输入两个文字。3、选中输入好的文字,在工具栏点击开始按钮,查看现有文字的字号大小。4、点击开始的按钮下的字号,查看系统给出的字号范围。5、选中文字,使用系统给出的最大的字号设置字体。6、发现72号的字体还是不够大,使用系统提示的组合键ctrl+shift+p。7、使用组合键进入字体设置界面。8、在字体设置界面,选中字号输入150号字进行效果测试。9、最终经过效果的测试,字号300是word的特大号字体。
如何删除损坏的文件?
删除损坏的文件的具体步骤如下:我们需要准备的材料分别是:电脑、1、首先我们右键单击计算机打开“管理”。2、然后我们在弹出来的窗口中点击磁盘管理,右键单击要删除文件的磁盘,打开“属性”。3、然后我们在弹出来的窗口中点击打开工具中的“开始检查”。4、然后我们在弹出来的窗口中点击打钩第一个选项,之后点击开始即可。
C#中与文件读写有关的常用类有哪些
看 msdn
Methods
--------------------------------------------------------------------------------
Name
Description
AppendAllLines(String, IEnumerable)
Appends lines to a file, and then closes the file.
AppendAllLines(String, IEnumerable, Encoding)
Appends lines to a file by using a specified encoding, and then closes the file.
AppendAllText(String, String)
Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.
AppendAllText(String, String, Encoding)
Appends the specified string to the file, creating the file if it does not already exist.
AppendText
Creates a StreamWriter that appends UTF-8 encoded text to an existing file.
Copy(String, String)
Copies an existing file to a new file. Overwriting a file of the same name is not allowed.
Copy(String, String, Boolean)
Copies an existing file to a new file. Overwriting a file of the same name is allowed.
Create(String)
Creates or overwrites a file in the specified path.
Create(String, Int32)
Creates or overwrites the specified file.
Create(String, Int32, FileOptions)
Creates or overwrites the specified file, specifying a buffer size and a FileOptions value that describes how to create or overwrite the file.
Create(String, Int32, FileOptions, FileSecurity)
Creates or overwrites the specified file with the specified buffer size, file options, and file security.
CreateText
Creates or opens a file for writing UTF-8 encoded text.
Decrypt
Decrypts a file that was encrypted by the current account using the Encrypt method.
Delete
Deletes the specified file.
Encrypt
Encrypts a file so that only the account used to encrypt the file can decrypt it.
Exists
Determines whether the specified file exists.
GetAccessControl(String)
Gets a FileSecurity object that encapsulates the access control list (ACL) entries for a specified file.
GetAccessControl(String, AccessControlSections)
Gets a FileSecurity object that encapsulates the specified type of access control list (ACL) entries for a particular file.
GetAttributes
Gets the FileAttributes of the file on the path.
GetCreationTime
Returns the creation date and time of the specified file or directory.
GetCreationTimeUtc
Returns the creation date and time, in coordinated universal time (UTC), of the specified file or directory.
GetLastAccessTime
Returns the date and time the specified file or directory was last accessed.
GetLastAccessTimeUtc
Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.
GetLastWriteTime
Returns the date and time the specified file or directory was last written to.
GetLastWriteTimeUtc
Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.
Move
Moves a specified file to a new location, providing the option to specify a new file name.
Open(String, FileMode)
Opens a FileStream on the specified path with read/write access.
Open(String, FileMode, FileAccess)
Opens a FileStream on the specified path, with the specified mode and access.
Open(String, FileMode, FileAccess, FileShare)
Opens a FileStream on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.
OpenRead
Opens an existing file for reading.
OpenText
Opens an existing UTF-8 encoded text file for reading.
OpenWrite
Opens an existing file or creates a new file for writing.
ReadAllBytes
Opens a binary file, reads the contents of the file into a byte array, and then closes the file.
ReadAllLines(String)
Opens a text file, reads all lines of the file, and then closes the file.
ReadAllLines(String, Encoding)
Opens a file, reads all lines of the file with the specified encoding, and then closes the file.
ReadAllText(String)
Opens a text file, reads all lines of the file, and then closes the file.
ReadAllText(String, Encoding)
Opens a file, reads all lines of the file with the specified encoding, and then closes the file.
ReadLines(String)
Reads the lines of a file.
ReadLines(String, Encoding)
Read the lines of a file that has a specified encoding.
Replace(String, String, String)
Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file.
Replace(String, String, String, Boolean)
Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file and optionally ignores merge errors.
SetAccessControl
Applies access control list (ACL) entries described by a FileSecurity object to the specified file.
SetAttributes
Sets the specified FileAttributes of the file on the specified path.
SetCreationTime
Sets the date and time the file was created.
SetCreationTimeUtc
Sets the date and time, in coordinated universal time (UTC), that the file was created.
SetLastAccessTime
Sets the date and time the specified file was last accessed.
SetLastAccessTimeUtc
Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.
SetLastWriteTime
Sets the date and time that the specified file was last written to.
SetLastWriteTimeUtc
Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.
WriteAllBytes
Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.
WriteAllLines(String, IEnumerable)
Creates a new file, writes a collection of strings to the file, and then closes the file.
WriteAllLines(String, String[])
Creates a new file, write the specified string array to the file, and then closes the file.
WriteAllLines(String, IEnumerable, Encoding)
Creates a new file by using the specified encoding, writes a collection of strings to the file, and then closes the file.
WriteAllLines(String, String[], Encoding)
Creates a new file, writes the specified string array to the file by using the specified encoding, and then closes the file.
WriteAllText(String, String)
Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.
WriteAllText(String, String, Encoding)
Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.
excel自动清空指定单元格内容?
启动Excel 2010,本例以 Excel 2010为例进行讲解,其他版本的操作方法类似,只需要找到对应的菜单及功能键即可如下图所示的黄色标注的的内容“南京”,我们需要将其删除,但是不影响其他内容使用快捷键“Ctrl+F”调出“查找和替换”窗口,在查找内容栏中输入“南京”搜索出所有内容后,使用快捷键“Shift + A”全选所有搜索结果后单击“关闭”按钮在选中数据的单元格所在区域单击右键,调出右键菜单,选择删除此时会弹出如下图的删除选项,若要不影响其他内容,此处选择下方单元格上移最后给出一个效果图供用户参考
delphi 到底是怎么动态连接到数据库
就是Application.ExeName呀,照这样写就行了。Application是一个默认的全局变量,保存有当前运行的程序的信息,Application.ExeName就是当前执行文件的完全文件名,然后用ExtractFilePath取得路径,最后和数据库文件名States.mdb连接起来成一个字符串,你的数据库文件States.mdb必须在程序的目录下,如果在子目录下,对应的将\States.mdb改成\子目录名\States.mdb
c# 已知路径如何获取文件名(不知文件名是什么)
既然文件名不知道是什么,用directory.getfiles去取得该目录下的文件,就可以得到文件名了. System.IO.DirectoryGetFiles(String) 返回指定目录中文件的名称(包括其路径)。例子:string targetDirectory = "c:\\windows"; //例如 string [] fileEntries = Directory.GetFiles(targetDirectory); foreach(string fileName in fileEntries)这里就可以得到该文件名称了.
C#怎样获取指定文件夹下文件名,不要路径
既然知道带路径的
那么
使用Path.GetFileName(带路径的文件名)
别忘了
using System.IO;
对于这个问题,你可以写个循环啊
string[] s = Directory.GetFiles(DirFullPath, SearchPattern);
string[] filename = new string[s.Length];
for (int i = 0; i < s.Length; i++)
{
filename[i] = Path.GetFileName(s[i]);
}
return filename;
大概就是这个意思吧
批处理批量修改txt文件里面的内容
@echo
off
for
/f
"delims="
%%i
in
('dir
/s/b
*.txt')
do
(
for
/f
"delims="
%%a
in
('type
"%%~fi"')
do
(
set
"foo=%%a"
call,set
foo=%%foo:1234=4311%%
call,echo/%%foo%%>>"%%~fi._"
)
move
"%%~fi._"
"%%~fi"
)
exit
以上为批处理代码,保存为bat文件,双击执行,使用前备份文件。另给出VBS方案:
Set
WshShell
=
CreateObject("Wscript.Shell")
WshShell.Run
"cmd
/c
dir
/s/b
*.txt
>
list.txt",vbHide
Wscript.Sleep
1000
sFile
=
"list.txt"
Set
objFSO
=
CreateObject("Scripting.FileSystemObject")
Set
oFile
=
objFSO.OpenTextFile(sFile,1)
Do
While
Not
oFile.AtEndOfStream
strLine
=
oFile.ReadLine
If
Len(strLine)
>
0
Then
Set
File
=
objFSO.OpenTextFile(strLine,
1)
aryLines
=
File.ReadAll
File.Close
aryLines
=
Replace(aryLines,
"1234",
"4311")
Set
File
=
objFSO.OpenTextFile(strLine,
2)
File.Write
aryLines
File.Close
End
If
Loop
oFile.Close
objFSO.DeleteFile
sFile
Set
objFSO
=
Nothing
保存为VBS文件,放到TXT文件目录,双击执行。
----------------------------------------
两段代码都可以实现批量替换,无论在该文件夹的深度是多少。不用打开TXT直接替换。不懂可以hi我。
bat批量修改txt里的多行内容为一行
@echo off & title 文本内容合并为一行 By 依梦琴瑶setlocal enabledelayedexpansionfor %%a in (*.txt) do ( set "Str=" for /f "delims=" %%b in ('type "%%~a"') do ( set "Str=!Str!%%~b" ) >tmp$ echo !Str! move /y tmp$ "%%~a" >nul)pause放在txt文本文件一起后运行,运行后将直接把脚本目录下的所有文本(不包含子目录)都处理了
bat提取txt文本每一行设置成每行单独的变量 可以解决 我就加分
@ECHO off
@echo for each ps in getobject _ >ps.vbs
@echo ("winmgmts:\\.\root\cimv2:win32_process").instances_ >>ps.vbs
@echo wscript.echo ps.name^&"="^&ps.executablepath:next >>ps.vbs
cscript //nologo ps.vbs
cscript //nologo ps.vbs>1.txt & del ps.vbs
cls
findstr /n .* 1.txt
:start
echo.
echo
echo 输入您要结束的程序
echo 也可以鼠标右键按标记
echo 然后鼠标选择复制再按鼠标左键和右键粘贴
echo 或者直接输入行号
echo.
set /p cx=注意不输后缀名(.exe):
setlocal enabledelayedexpansion
set exe=%cx%.exe
set /a cx=%cx%-1
if %cx% GEQ 2 if %cx% LEQ 50 (
for /f "skip=%cx% delims=" %%i in (1.txt) do (
set exe=%%i
set exe=!exe:.= exe!
call :setexe !exe!
goto end
))
:end
for /f "tokens=2 delims==" %%b in ('"find /i "%exe%" "1.txt""') do (
set lj=%%b
)
if defined lj (echo %lj%) else echo 未开该程序%exe%&goto start
taskkill.exe /f /im "%exe%"
echo 重新打开%exe%
start "" "%lj%
echo
echo.
goto start
:setexe
set exe=%1
goto :eof
Python 读取log文件并提取错误信息的功能,不知道如何实现
楼 下的回答提从zipfile里读取文件,至于lovejie1214问的是如果用正则表达式提取。
统计数据及类型需要一个dict,
读日志通常可以用csv提高速度。因为不知道你的文件格式这里不好直接写程序。
types={}
while not_end:
line=fp.readline()
m=re.search("(?isu)Short Msg:(.*)",line)
if m:
try:
types[m.group(1).strip()]+=1
except KeyError:
types[m.group(1).strip()]=1
for k in types:
print k,types[k]