<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="et">
	<id>http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=Writing_and_Reading_Binary_Data_%28ITS8020%29</id>
	<title>Writing and Reading Binary Data (ITS8020) - Redigeerimiste ajalugu</title>
	<link rel="self" type="application/atom+xml" href="http://courses.cs.taltech.ee/w/index.php?action=history&amp;feed=atom&amp;title=Writing_and_Reading_Binary_Data_%28ITS8020%29"/>
	<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=Writing_and_Reading_Binary_Data_(ITS8020)&amp;action=history"/>
	<updated>2026-04-06T20:47:33Z</updated>
	<subtitle>Selle lehekülje redigeerimiste ajalugu</subtitle>
	<generator>MediaWiki 1.35.9</generator>
	<entry>
		<id>http://courses.cs.taltech.ee/w/index.php?title=Writing_and_Reading_Binary_Data_(ITS8020)&amp;diff=7600&amp;oldid=prev</id>
		<title>Irve: Uus lehekülg: &#039;This practice is about writing data in binary format.   == Task ==  There are two tasks; the first one is simple fread() fwrite() to get the general idea accross, the second need...&#039;</title>
		<link rel="alternate" type="text/html" href="http://courses.cs.taltech.ee/w/index.php?title=Writing_and_Reading_Binary_Data_(ITS8020)&amp;diff=7600&amp;oldid=prev"/>
		<updated>2018-11-02T09:29:17Z</updated>

		<summary type="html">&lt;p&gt;Uus lehekülg: &amp;#039;This practice is about writing data in binary format.   == Task ==  There are two tasks; the first one is simple fread() fwrite() to get the general idea accross, the second need...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Uus lehekülg&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This practice is about writing data in binary format. &lt;br /&gt;
&lt;br /&gt;
== Task ==&lt;br /&gt;
&lt;br /&gt;
There are two tasks; the first one is simple fread() fwrite() to get the general idea accross, the second needs some thinking.&lt;br /&gt;
&lt;br /&gt;
=== Runtimes ===&lt;br /&gt;
&lt;br /&gt;
* Write a program which counts and prints how many times it has been run.&lt;br /&gt;
** Save the amount of runs into a file named runtimes.dat&lt;br /&gt;
** If the file is missing, write a binary 1 into the file, save and exit.&lt;br /&gt;
** If the file exists, read the count from the file, increment it, print it and write the new count into the file before exiting.&lt;br /&gt;
&lt;br /&gt;
=== Array to file and from file ===&lt;br /&gt;
&lt;br /&gt;
Here we could also learn using [http://linux.die.net/man/3/getopt getopt()] function, if task seems too simple.&lt;br /&gt;
&lt;br /&gt;
* If the program starts without command line options, show help&lt;br /&gt;
* If program is run with&lt;br /&gt;
  table -c filename.dat -n 10&lt;br /&gt;
: Create 10x10 element 2d array (okay to create just a multiplication table here) and write it into file named filename.dat (save size, then elements)&lt;br /&gt;
* If program is run with&lt;br /&gt;
  table -r filename.dat&lt;br /&gt;
: Open the file, read the array dimensions if stored, show the array on the screen.&lt;br /&gt;
äidake tabel ekraanile.&lt;br /&gt;
&lt;br /&gt;
== Hints ==&lt;br /&gt;
&lt;br /&gt;
* It is advisable to store the table so that the first 4 bytes of the file hold the table dimensions, then the array elements would follow.&lt;br /&gt;
* If the numbers in file are human-readable you are doing the binary wrong.&lt;/div&gt;</summary>
		<author><name>Irve</name></author>
	</entry>
</feed>