text-files

Where is hex code of the “EOF” character?

萝らか妹 提交于 2019-11-27 13:27:10
问题 As far as know in the end of all files, specially text files, there is a Hex code for EOF or NULL character. And when we want to write a program and read the contents of a text file, we send the read function until we receive that EOF hexcode. My question : I downloaded some tools to see a hex view of a text file. but I can't see any hex code for EOF (End Of File/NULL) or EOT (End Of Text) ASCII/Hex code tables : This is output of Hex viewer tools: Note : My input file is a text file that its

Delphi: Alternative to using Reset/ReadLn for text file reading

烈酒焚心 提交于 2019-11-27 13:22:52
问题 i want to process a text file line by line. In the olden days i loaded the file into a StringList : slFile := TStringList.Create(); slFile.LoadFromFile(filename); for i := 0 to slFile.Count-1 do begin oneLine := slFile.Strings[i]; //process the line end; Problem with that is once the file gets to be a few hundred megabytes, i have to allocate a huge chunk of memory; when really i only need enough memory to hold one line at a time. (Plus, you can't really indicate progress when you the system

In Fortran 90, what is a good way to write an array to a text file, row-wise?

三世轮回 提交于 2019-11-27 13:10:57
问题 I am new to Fortran, and I would like to be able to write a two-dimensional array to a text file, in a row-wise manner (spaces between columns, and each row on its own line). I have tried the following, and it seems to work in the following simple example: PROGRAM test3 IMPLICIT NONE INTEGER :: i, j, k, numrows, numcols INTEGER, DIMENSION(:,:), ALLOCATABLE :: a numrows=5001 numcols=762 ALLOCATE(a(numrows,numcols)) k=1 DO i=1,SIZE(a,1) DO j=1,SIZE(a,2) a(i,j)=k k=k+1 END DO END DO OPEN(UNIT=12

Line break not working when writing to text file in PHP

六月ゝ 毕业季﹏ 提交于 2019-11-27 13:07:40
I have the following test script: <?php $myFile = "testFile.txt"; $fh = fopen($myFile, 'w') or die("can't open file"); $stringData = "Floppy Jalopy\n"; fwrite($fh, $stringData); $stringData = "Pointy Pinto\n"; fwrite($fh, $stringData); fclose($fh); ?> when run however and opened usign Notepad, the data is returned in a single line without breaks as: Floppy Jalopy(crazy box)Pointy Pinto(crazy box) where i cant find the appropriate character for 'crazy box' but its a REALLY crazy box. WHAT GIVES! If you want to open the file in Windows notepad, you must use Windows line breaks: \r\n It is best

Ban IPs from text file using htaccess

家住魔仙堡 提交于 2019-11-27 12:51:43
I read and understand how to block an ip using htaccess: order deny,allow deny from 111.222.33.44 deny from 55.66.77.88 ... allow from all But my list of black IPs includes thousands of IPs. I save all IPs to a blacklist.txt file. Can I use htaccess to call blacklist.txt and block all IPs which are stored in this file? If so, how? You can try using variations of RewriteMap . You'll need access to the server/vhost config because that directive only works there. You can then use the map inside htaccess files. Say your blacklist.txt file looks like this: 111.222.33.44 deny 55.66.77.88 deny 192

Create Text File Without BOM

久未见 提交于 2019-11-27 12:33:39
I tried this aproach without any success the code I'm using: // File name String filename = String.Format("{0:ddMMyyHHmm}", dtFileCreated); String filePath = Path.Combine(Server.MapPath("App_Data"), filename + ".txt"); // Process myObject pbs = new myObject(); pbs.GenerateFile(); // pbs.GeneratedFile is a StringBuilder object // Save file Encoding utf8WithoutBom = new UTF8Encoding(true); TextWriter tw = new StreamWriter(filePath, false, utf8WithoutBom); foreach (string s in pbs.GeneratedFile.ToArray()) tw.WriteLine(s); tw.Close(); // Push Generated File into Client Response.Clear(); Response

Reading specific columns from a text file in python

大憨熊 提交于 2019-11-27 12:21:35
问题 I have a text file which contains a table comprised of numbers e.g: 5 10 6 6 20 1 7 30 4 8 40 3 9 23 1 4 13 6 if for example I want the numbers contained only in the second column, how do i extract that column into a list? 回答1: f=open(file,"r") lines=f.readlines() result=[] for x in lines: result.append(x.split(' ')[1]) f.close() You can do the same using a list comprehension print [x.split(' ')[1] for x in open(file).readlines()] Docs on split() string.split(s[, sep[, maxsplit]]) Return a

How to efficiently write a large text file in C#?

雨燕双飞 提交于 2019-11-27 10:29:32
问题 I am creating a method in C# which generates a text file for a Google Product Feed. The feed will contain upwards of 30,000 records and the text file currently weighs in at ~7Mb. Here's the code I am currently using (some lines removed for brevity's sake). public static void GenerateTextFile(string filePath) { var sb = new StringBuilder(1000); sb.Append("availability").Append("\t"); sb.Append("condition").Append("\t"); sb.Append("description").Append("\t"); // repetitive code hidden for

Find lines from a file which are not present in another file [duplicate]

≯℡__Kan透↙ 提交于 2019-11-27 10:25:21
This question already has an answer here: Fast way of finding lines in one file that are not in another? 10 answers I have two files (let's say a.txt and b.txt ), both of which has a list of names. I have already run sort on both the files. Now I want to find lines from a.txt which are not present in b.txt . (I spent lot of time to find the answer for this question, so documenting it for future reference) Sudar The command you have to use is not diff but comm comm -23 a.txt b.txt By default, comm outputs 3 columns: left-only , right-only , both . The -1 , -2 and -3 switches suppress these

Tools to search for strings inside files without indexing [closed]

拈花ヽ惹草 提交于 2019-11-27 10:04:05
I have to change some connection strings in an incredibly old legacy application, and the programmers who made it thought it would be a great idea to plaster the entire app with connection strings all over the place. Visual Studio's "current project" search is incredible slow, and I don't trust Windows Search. So, what's the best free, non-indexed text search tool out there? All it should do is return a list with files that contain the wanted string inside a folder and its subfolders. I'm running Windows 2003 Server. Windows Grep does this really well. Edit: Windows Grep is no longer being