textfiles

Parse values from a text file in C

Possible Duplicate: Parsing text in C Say I have written to a text file in this format: key1/value1 key2/value2 akey/withavalue anotherkey/withanothervalue I have a linked list like: struct Node { char *key; char *value; struct Node *next; }; to hold the values. How would I read key1 and value1? I was thinkin...

Remove special chars from a File

I'm trying to open a textfile and remove all the special chars ñ Ñ ' á í etc... the file its a Layout that the clients send to me and i parse it to send the file to an AS400 server but i have to remove all special chars. THE PROBLEM IS: some files with some special chars when i open it in c# it read the special chars and Two different...

Read text file in Java

I have a text file. I would like to retrieve the content from one line to another line. For example, the file may be 200K lines. I want to read the content from line 78 to line 2735. Since the file may be very large, I do not want to read the whole content into the memory. ...

Reading bytes from a text file that has the form of machine code in C?

I have a text file with machine code in this form: B2 0A 05 B2 1A 01 B3 08 00 17 B2 09 18 where an instruction has this format: OP Mode Operand Note: Operand could be 1 or 2 bytes. Where:(example) OP = B2 Mode = 0A Operand = 05 How can I read the bytes in a variable? As shown in the above example. When i read the file I g...

Create an anonymous type object from an arbitrary text file

I need a sensible way to draw arbitrary text files into a C# program, and produce an arbitrary anonymous type object, or perhaps a composite dictionary of some sort. I have a representative text file that looks like this: adapter 1: LPe11002 Factory IEEE: 10000000 C97A83FC Non-Volatile WWPN: 10000000 C93D6A8A , WWNN: 20000000 C93D6...

Reading a text file in Java

I want to read a text file containing space sepearted values. Values are integers. How can I read it and put it in an array list? Here is an example of contents of the text file: 1 62 4 55 5 6 77 I want to have it in an arraylist as [1, 62, 4, 55, 5, 6, 77]. How can I do it in Java? ...

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

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 ha...

join 3 files by first Column with join (was awk) ?

i have three similar files, they are all like this: File A ID1 Value1a ID2 Value2a . . . IDN Value2n and i want an output like this Output ID1 Value1a Value1b Value1c ID2 Value2a Value2b Value2c ..... IDN ValueNa ValueNb ValueNc Looking to the first line, i want value1A to be the value of id1 in fileA, value1B the value of ...

Beginner C++ - Opening a text file for reading if it exists, if it doesn't, create it empty

Hello everyone! I am writing a high-score sub-routine for a text-based game. Here's what I have so far. void Game::loadHiScores(string filename) { fstream hiscores(filename.c_str()); // what flags are needed? int score; string name; Score temp; if (hiscores.is_open()) { for (size_t i = 0; i < TOTAL_HISC...

Which would be better? Storing/access data in a local text file, or in a database?

Basically, I'm still working on a puzzle-related website (micro-site really), and I'm making a tool that lets you input a word pattern (e.g. "r??n") and get all the matching words (in this case: rain, rein, ruin, etc.). Should I store the words in local text files (such as words5.txt, which would have a return-delimited list of 5-letter ...

Search in big text log files

Hi, let's say you have an game server which creating text log files of gamers actions, and from time to time you need to lookup something in those logs files (like investigating an scam or loosing an item). Just for example you have 100 files and each file have size between 20MB and 50MB - How you would search them quickly? What I hav...

Map element position in data file to class property

I need to read/write files, following a format provided by a third party specification. The specification itself is pretty simple: it says the position and the size of the data that will be saved in the file. For example: Position Size Description -------------------------------------------------- 0001 10 ...

delete same lines from text file by c#

how to delete same lines in file .txt but keep one of them using c# ? ...

How to retain similar character encoding

I have a logfile that contains the half character ½, I need to process this log file and rewrite certain lines to a new file, which contain that character. However, when I write out the file the characters appear in notepad incorrectly. I know this is some kind of encoding issue, and i'm not sure if it's just that the files i'm writing...

Embed Text File in a Resource in a native Windows Application

I have a C++ Windows program. I have a text file that has some data. Currently, the text file is a separate file, and it is loaded at runtime and parsed. How is it possible to embed this into the binary as a resource? ...

Determine what line ending is used in a text file

Whats the best way in C# to determine the line endings used in a text file (Unix, Windows, Mac)? ...

Using DirectoryInfo in C#

If there a more efficient way to do the following: DirectoryInfo di = new DirectoryInfo(@"c:\"); newFileName = Path.Combine(di.FullName, "MyFile.Txt"); I realise that it’s only two lines of code, but given that I already have the directory, it feels like I should be able to do something like: newFileName = di.Combine(“MyFile.txt”); ...

How can I read a textfile into matlab and make it a list?

I have a textfile that has the format gene complement(22995..24539) /gene="ppp" /locus_tag="MRA_0020" CDS complement(22995..24539) /gene="ppp" /locus_tag="MRA_0020" /codon_start=1 /transl_table=11 ...

How can I make this text file into a list in MATLAB?

I have a text file and would like to import it into MATLAB and make it a list: Person1 name = steven grade = 11 age= 17 Person2 name = mike grade = 9 age= 15 Person3 name = taylor grade = 11 age= 17 There are a few hundred entries like these above. Each are separated by a blank line. I was thinking I could scan the text and make the...

MS Access 2007 Import Not Working?

Hi guys. I just switched from Access 2003 to Access 2007. In the very first "dev" copy (as I call it) pre-split, pre-front end, I need to import some data that are text files. I try to use the ribbon to do this, and after I walk through the steps I get this little pop up box that states Microsoft Access has determined this to be a pot...