reading

How do I read hex numbers into an unsigned int in C [Solved]

I'm wanting to read hex numbers from a text file into an unsigned integer so that I can execute Machine instructions. It's just a simulation type thing that looks inside the text file and according to the values and its corresponding instruction outputs the new values in the registers. For example, the instructions would be: 1RXY -> ...

Generically reading a well-formed binary file

I'm trying to read contents of a game's map/model files into a program for the purposes of writing a small model viewer and testing out some DirectX features. The model/map file formats are chunked in nature, and I know the format of these files. I can easily read the files by parsing through the individual chunks, using an approach like...

What is reading source on an ebook reader like?

There are a few open source projects I would really like to read through the code of to understand better / improve on. The problem is, for me, reading for a long time on the computer screen is tedious. I would love to be able to read code while lounging around and on a screen that was better on my eyes. Has anyone ever tried reading cod...

MSMQ slow queue reading

I am using an open source .Net library which uses MSMQ underneath. After about a week or 2, the service slows down (not timed exactly but general guess). It appears that what is happening is messages from MSMQ are only being read exactly once every 10 seconds. Normally, they are read instantly. So they will be read at T+10sec, T+20se...

Reading long ASCII-files in C.

In C, if I read a line from the file by function fgetc, there might be a stack overflow. Suppose that some has written a program which outputs a a huge line of ASCII data in one line on a particular file. How can I read that data in my C program to screen? I know that I can read only, say 100 character at once but I don't know how can I ...

What should I be reading for intermediate Cocoa programming instruction?

I'm looking for reading material to bridge the gap between "read Hillegass multiple times" and "productive Cocoa programmer". What materials do you suggest? I am not particularly looking for iPhone/Cocoa Touch resources, though if they are also relevant to Mac programming, I'd take a look. Edit: I do appreciate that there is no substit...

Fastest way to read a file line by line with an arbitrary number of characters in each

Ok, I'm trying to figure out which way would be faster to read a text file that I'm working with. The contents of the file look like this 1982 3923 3542 4343 2344 3453 2 334 423423 32432 23423 They're basically just an arbitrary number of int numbers and I need to read line by line. Would it be better to use getline or the insertion ...

Easy Ruby libraries to understand for beginner

Hi. I'm at the point in learning Ruby where I'd like to look at some small-ish libraries' source code to see how they were built. I do not know what is considered a small library but was hoping SO could recommend some easy-to-understand libraries to study. So if anyone knows a very tiny library or two that's a good example for novice Ru...

Reading text file into an array of lines in C

Using C I would like to read in the contents of a text file in such a way as to have when all is said and done an array of strings with the nth string representing the nth line of the text file. The lines of the file can be arbitrarily long. What's an elegant way of accomplishing this? I know of some neat tricks to read a text file dire...

java null pointer exception

hi, I'm getting java.lang.NullPointerException at while ((len = in.read(buf , 0 , buf.length)) >= 0) in following method: public void copy(String src, File dst) throws IOException { InputStream in = getClass().getResourceAsStream(src); OutputStream out = new FileOutputStream(dst); byte[] buf = new byte[1012]; ...

reading multiple files in a folder in java

hi, can any one help me . I want to read all the files in a folder through java. can any help me out???.. ...

Apache POI - error in reading excel file

I am using poi-3.5-beta5 to read excel file. I am trying to open excel file through XSSFWorkbook workBook = new XSSFWorkbook (xlsPath); i am getting following error (although i am not using log4j) Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger at org.apache.poi.openxml4j.opc.Package.(Package.java:...

reading error dialog in java

i need to read some error message in java, i tried to do this in getErrorStream and then readLine, but i got exeption. i added a link to a picture of the error message i want to read http://yfrog.com/0986806495p TNX ...

Excel 2007(.xlsx) Reading code using POI 3.5 in java?

Hi, I have downloaded latest POI version 3.5. I want to read the Excel file (.xlsx format) using the POI. If anybody has any Example source code or any URL or any other code snippet which can read the Excel file (.xlsx format) using the latest version of POI,which would be appreciated. Thanks, Mishal Shah ...

c reading a text file into array line by line and print them

hi, i have the following c# code snippet string[] lines = File.ReadAllLines(@"C:\test.txt"); for(int i=0; i<lines.Length; i++) Console.WriteLine(lines[i]); Can you help me to convert it to C. Thanks! ...

c retrieving total line numbers in a file

hi can anyone show me how to get the total number of lines in a text file with programming language C? thanks! ...

file reading and writting inside asp.net web application

Hi friends, I have developed a web application in visual studio 2008 its in asp.net c#. i have user a html page and one txt file in that application but both are not inside my application bot are outside so when i try to run the same application in another system i will get error because of that files. i want to include that fil...

reading bytes in a file in vb.net

After getting the file name I create a new filestream and load all the bytes from the FileStream into a byte array, now I need to get certain bytes and store them in fields like the second 4 bytes are the time the file was created. When storing these in the variables should I store them as bytes or as string/integers/etc. Or have I done...

Reading files multi-data-type (c++)

Dear all, I want to read from one file that has several kinds of data-types. I utilize ifstream (C++ language) but it can't read strings. In fact, I have written a code that has too many options and input parameters. Now, I want to read these parameters and (bool) options from an input file, then I can run my program by edition of inp...

C#: Whats the fastest way of reading and writing binary?

I'm currently optimizing an application, one of the operations that is done very often is reading and writing binary. I need 2 types of functions: Set(byte[] target, int index, int value); int Get(byte[] source, int index); These functions are needed for signed and unsigned short, int and long in big and little endian order. Here ar...