reading

What is the end of line character when reading a file in using C++ get(char& c);?

My issue is I am trying my first attempt at writing a very basic lexical analyzer for ascii text files. so far, it reads and compares to my token list properly, however I am unable to grab the final token without a space or pressing enter. I've tried using the delimiter ^Z ASCII 26 as another selection before comparing the string to my t...

Fancy way to read a file in C++ : strange performance issue

The usual way to read a file in C++ is this one: std::ifstream file("file.txt", std::ios::binary | std::ios::ate); std::vector<char> data(file.tellg()); file.seekg(0, std::ios::beg); file.read(data.data(), data.size()); Reading a 1.6 MB file is almost instant. But recently, I discovered std::istream_iterator and wanted to try it in o...

Do you prefer to read/reference your technical books in print or digital form?

Wondering about stack overflow's reading habits. Feel free to include other interesting quirks. For example, if you have your own search engine for this purpose! ...

How do you get enough time to learn new things?

How do you catch up with new things and technologies? I mean, I'm really interested in some technology. It has lots of great books, that I need to read to be proficient in it. Not to mention that you only know what you actually worked with, so reading does not give you much, you have to work with this technology. Moreover, there are clas...

Reading XML in Java

Hi guys, I guess this question of mine is pretty basic but since Ive never done it before or havent come across anything good on the internet while i searched for this, here goes ... I have an XML that I want my java code to read. The sample of the XML would be as follows -- <getLabel labelId="BLAH"> <dataObject name="packageInfo"> ...

Loading tiles for a 2D game

Hi Im trying to make an 2D online game (with Z positions), and currently im working with loading a map from a txt file. I have three different map files. One contains an int for each tile saying what kind of floor there is, one saying what kind of decoration there is, and one saying what might be covering the tile. The problem is that t...

How long to spend exclusively on SE fundamentals?

Some quick background: This Fall, I'm heading into my second year perusing a BS in Software Engineering. I picked up programming in my first year of high school, learning languages like Basic and PHP. My senior year of high school was when I got much more serious. For the last two years, I've been reading for about two hours a day. I do...

An HTML ebook that can be used as an HTML reference

PHP has a great downloadable reference - since there's nothing similar for HTML I'm looking for a great HTML book that describes each element one by one .. almost like a specification for HTML, but written in simple terms that an entry-level programmer could figure out and learn from. Now don't give me the W3C HTML spec since that's far...

In C, how should I read a text file and print all strings

I have a text file named test.txt I want to write a C program that can read this file and print the content to the console (assume the file contains only ASCII text). I don't know how to get the size of my string variable. Like this: char str[999]; FILE * file; file = fopen( "test.txt" , "r"); if (file) { while (fscanf(file, "%s",...

Best practice for reading csv (with variable number of lines) into data structures

Hey guys, I'm writing a small program to read in a csv with a variable number of lines and have a question about best practices: Is the best way to create storage for the data on each line to make an array that holds the data structures of the csv (one per each line of csv)? Size allocated to the array could be set to a large number (f...

Reading data from a Smart Card (preferably with Java)

I would like to be able to read a few bytes of unencrypted data which is stored in a smart card. I have the reader and know that the Sun version of Java 6 includes javax.smartcardio and I have read a bit about these APIs. Having never worked with smart cards before I wonder if there is a simple way to read bytes of date in a given secto...

Urgent! Need help selecting IDs from a table if 2 conditions in other tables match

Sorry for the worst question title ever but I find it hard to explain in a sentence what im having trouble with. I am developing a user feedback system using ASP.NET and C#. I have multiple tables and am trying to populate dropdown lists so that the feedback can be filtered. My tables: CREATE TABLE tblModules ( Module_ID nvarchar(10) ...

Writing to and reading from the same file, at the same time (disk being asynchronous?)

We're creating a web service where we're writing files to disk. Sometimes these files will be read at the same time as they are written. If we do this - writing and reading from the same file - we sometimes end up with files that are of the same length, but where some of the data inside are not the same. So with a 350mb file we get mayb...

Reading unicode character in java

I'm a bit new to java, When I assign a unicode string to String str = "\u0142o\u017Cy\u0142"; System.out.println(str); final StringBuilder stringBuilder = new StringBuilder(); InputStream inStream = new FileInputStream("C:/a.txt"); final InputStreamReader streamReader = new InputStreamReader(inStream, "UTF-8"); final Buffe...

How to read data in certain format

I have a log file that can get pretty big. The information in my log file is in a certain format and I want to be retreiving them a seperate blocks of data. For example, This is the start. Blah Blah Blah Blah Blah Blah Blah Blah Blah This is the start. Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Bla...

Why is the FileInputStream read() not blocking?

Hi there, I've got a Writer program that writes one line of text to a file, then waits until the user hits return before it writes another line and then exits. Only after that is the file closed. The code: public class Writer { Writer() { } public static String[] strings = { "Hello World", ...

are there any API for the EPUB standard?

I want to work on personal project working with books and magazines. I was wondering if there were any APIs for the EPUB standard. That are open to the public. Please and thank you GC ...

Parse a log file and get entry data

I have a big log file with multiple lines separated by new line. Each line entry stores four values. If I am reading the log file and want to store this information, what data type/object should I use? Example: source1 destination1 result time source2 destination1 result time sources3 destination2 result time The values are not uni...

Parse log file and get matching data

From the big log file (about like 2532910 lines), the lines that I am looking for are very few (like 10 or 12). What is the best way to match and read these lines? My code is in c#. Is there a way a reader/stream can read only a pattern matching data? Thanks ...

reading a barcode with a webcam

Hey, I'm trying to read a EAN-13 barcode from my webcam. I already wrote a class to do that work. I'm taking a picture from my webcam, trimming it to show ONLY the barcode, and reading the barcode with the code tables from wikipedia. For some reason, the barcode gets trimmed, but the output is always "0-1-1-1-1-1-1-1-1-1-1-1-1". I wonder...