text-files

How to read correctly certain strings from file in c?

烈酒焚心 提交于 2020-01-06 05:56:26
问题 I am trying to write a program in c that compare strings. The strings are given in pairs and in the top of the file there is the number of the pairs. The file has a form like the following: 2 a: 01010100000101011111 01001010100000001111 00000000000011110000 b: 00000111110000010001 10101010100111110001 a: 00000011111111111100 00111111111111000 b: 00000001111001010101 My problem is to read the strings properly in order to execute comparisons etc Here is my code: #include <stdio.h> #include

How to recognize name (from text file) in user input and then print name

我的梦境 提交于 2020-01-06 04:50:23
问题 My ideal goal is for the chat bot to recognize that you are talking about one of your siblings. So, when you mention your brother or sister (either by name or the keywords: my brother/sister) the chat bot will already know who they are from the data given in their text file. I have already figured out the keyword part, but when I mention them by name (For example: I can't stand James). The chat bot doesn't print what I want it to and when the user tells the chat bot their sibling's name it

Use Python to manipulate txt file presentation of key-value grouping

南笙酒味 提交于 2020-01-05 12:09:36
问题 I am trying to use Python in order to manipulate a text file from Format A: Key1 Key1value1 Key1value2 Key1value3 Key2 Key2value1 Key2value2 Key2value3 Key3... Into Format B: Key1 Key1value1 Key1 Key1value2 Key1 Key1value3 Key2 Key2value1 Key2 Key2value2 Key2 Key2value3 Key3 Key3value1... Specifically, here is a brief look at the file itself (only one key shown, thousands more in the full file): chr22:16287243: PASS patientID1 G/G patientID2 G/G patient ID3 G/G And the desired output here:

Use Python to manipulate txt file presentation of key-value grouping

南笙酒味 提交于 2020-01-05 12:09:21
问题 I am trying to use Python in order to manipulate a text file from Format A: Key1 Key1value1 Key1value2 Key1value3 Key2 Key2value1 Key2value2 Key2value3 Key3... Into Format B: Key1 Key1value1 Key1 Key1value2 Key1 Key1value3 Key2 Key2value1 Key2 Key2value2 Key2 Key2value3 Key3 Key3value1... Specifically, here is a brief look at the file itself (only one key shown, thousands more in the full file): chr22:16287243: PASS patientID1 G/G patientID2 G/G patient ID3 G/G And the desired output here:

Python: Finding values after searching for a string in a text files

柔情痞子 提交于 2020-01-05 04:30:11
问题 I'm new to the world of python and I'm trying to extract values from multiple text files. I can open up the files fine with a loop, but I'm looking for a straight forward way to search for a string and then return the value after it. My results text files look like this SUMMARY OF RESULTS Max tip rotation =,-18.1921,degrees Min tip rotation =,-0.3258,degrees Mean tip rotation =,-7.4164,degrees Max tip displacement =,6.9956,mm Min tip displacement =,0.7467,mm Mean tip displacement = ,2.4321,mm

Open a .txt file into a richTextBox in C#

左心房为你撑大大i 提交于 2020-01-04 03:01:06
问题 I want to be able to open a .txt file up into a richtextbox in c# and also into a global variable i have made called 'notes' but don't know how to do this. This is the code i have at the moment: OpenFileDialog opentext = new OpenFileDialog(); if (opentext.ShowDialog() == DialogResult.OK) { richTextBox1.Text = opentext.FileName; Globals.notes = opentext.FileName; } Only problem is it doesn't appear in neither the richtextbox nor in the global varibale, and the global allows it to be viewed in

SQL reserved keywords causing errors while importing data from text file

 ̄綄美尐妖づ 提交于 2020-01-03 16:58:52
问题 I have the following code. I am trying to import a text file in to sql table using php as suggested by one of the users on this site. Unfortunately my import got errors half way due to my text file having "Max and Min" words in the file. I tried to find out what i can do to avoid it. Most of the stuff i found was about using reserved words in the column name. But mine is not a column name it is inserted in the columns as data. Can this be avoided as I don't know how many other reserved words

Using ADO to query text files - terrible performance

こ雲淡風輕ζ 提交于 2020-01-03 02:54:14
问题 I'm writing some code in VBA behind Excel to pull some summary numbers out of potentially huge text files (10M+ rows) out on a network drive. In the past, these numbers have been pulled using greps in linux, but I was hoping to implement something that could be done with a click of a button in Excel for ease of use. My solution works, but it's like 25 times slower than a linux grep - takes 4 minutes to query 10M records, while the grep can do it in 10 seconds. Should I not be using ADO for

Asynchronous append to .txt file in delphi

谁说我不能喝 提交于 2020-01-03 00:54:12
问题 I'm trying to run a mail server and I want to keep track of the events like login, connect etc.. and I want to save this data in a log .txt file. But since it has to be done asynchronously I don't know how to lock the file for the current data append and then release it for next use. So basically I'm asking for help for a procedure called asyncAppendToFile(fileName : String; textToAppend : String) procedure SMTPServerUserLogin(ASender: TIdSMTPServerContext; const AUsername, APassword: String;

Pitfalls in my code for detecting text file encoding with Python?

血红的双手。 提交于 2020-01-02 04:08:09
问题 I know more about bicycle repair, chainsaw use and trench safety than I do Python or text encoding; with that in mind... Python text encoding seems to be a perennial issue (my own question: Searching text files' contents with various encodings with Python?, and others I've read: 1, 2. I've taken a crack at writing some code to guess the encoding below. In limited testing this code seems to work for my purposes* without me having to know an excess about the first three bytes of text encoding