Posts Tagged ‘input’

Gnuplot is a great tool for creating plots. LaTeX is a great tool for creating documents. Both are (or at least can be) created using a text editor and compiling the source. Both work with Windows, linux/unix and Mac. Wouldn’t it be great if you could include a gnuplot plot in a LaTeX document without […]

Splitting up LaTeX documents

Posted: 14th November 2010 by Tim in LaTeX
Tags: , , , , , , ,

If you’re writing a large LaTeX document like a book or a thesis, you probably don’t want to have the whole thing in one massive file. It’s the same principle as general programming; splitting the program into smaller components makes it easier to work with, maintain and test. In Microsoft Word you can do this […]

Reading from a file in C

Posted: 31st October 2010 by Tim in C
Tags: , , , , , , , ,

Reading data from a file is fairly common. The stdio.h provides us with a function, getline, which allows us to read lines from a file without worrying about buffer overflows and other memory corruption issues that C is famous for. The following code opens a file named “myfile.txt” and prints out each line with the […]

Reading from a file in C++

Posted: 27th September 2010 by Tim in C++
Tags: , , , , , , , , ,

Reading data from a file is common in programming. C++ makes this process fairly painless with the ifstream class. When combined with the string class, you can avoid the memory and buffer overflow issues which you would have to deal with in C. The following example opens a file named “myfile.txt” and prints out each […]