Commit e25f7be1 authored by ta_wu's avatar ta_wu

Latex-Vorlage, kommentare zu Quellcode a1

parent 024017da
*.pdf
*.log
*.aux
*.synctex.gz
Dies ist das Git-Repository der Gruppe 08 für TeI2 der Universität
Bremen im Wintersemester 2016/2017
File added
File added
\relax
\providecommand*\new@tpo@label[2]{}
\catcode `"\active
\select@language{ngerman}
\@writefile{toc}{\select@language{ngerman}}
......
This diff is collapsed.
File added
No preview for this file type
LINK.o = $(LINK.cc)
CFLAGS=-Werror -Wall -Wextra -g -O2 #-pg
CXXFLAGS=-Werror -Wall -Wextra -g -O2 #-pg
CXXFLAGS+=-std=c++0x
#CXXFLAGS+=-std=c++11
PROGRAMS:=mycp
.PHONY: all clean
all: $(PROGRAMS)
clean:
-$(RM) *~ *.o core $(PROGRAMS)
File added
#include <iostream>
#include <cerrno>
#include <fcntl.h>
#include <unistd.h>
int main(int argc, char **argv){
int fd_in, fd_out; // file destination input and output
char buf[1024]; // buffer for writing
ssize_t szr; // read. ssize_t for error handling (returns negative numbers)
bool ok = true; // validity boolean
if (argc != 3) { // too few or too many arguments. Must be mycp 2 3
std::cerr << "Usage: " << argv[0] << " source destination" << std::endl;
return -1;
}
/*
from man open
RDONLY Open the file for reading only.
*/
if ((fd_in = open(argv[1],O_RDONLY)) == -1){ // if origin is read-only
perror("open");
return -1;
}
/*
from man open
WRONLY Open the file for writing only.
CREAT Create the file if it does not already exist (without
this flag it is an error for the file not to exist).
TRUNC If the file exists it is truncated to zero length.
Name open - Open a file-based or command pipeline channel
Description:
This command opens a file, serial port, or command pipeline and returns
a channel identifier that may be used in future invocations of commands
like read, puts, and close. If the first character of fileName is not
| then the command opens a file: fileName gives the name of the file to
open, and it must conform to the conventions described in the filename
manual entry.
from GNU C Library - Permission Bits
S_IRUSR Read permission bit for the owner of the file. Often 0400.
S_IWUSR Write permission bit for the owner of the file. Usually 0200.
*/
if ((fd_out = open(argv[2],O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR)) == -1){
close(fd_in);
perror("open");
return -1;
}
while (ok && ((szr = read(fd_in, buf, sizeof(buf))) > 0)) { // file valid and not empty
ssize_t szw = 0; // file to write
while (szw < szr) {
if ((szw = write(fd_out, buf, szr)) < 0) { // if write size is negative
perror("write");
ok = false;
break;
} else {
szr -= szw;
}
}
}
fsync(fd_out);
close(fd_in);
close(fd_out);
return 0;
}
http://pubs.opengroup.org/onlinepubs/007908775/xsh/systypes.h.html
http://stackoverflow.com/questions/19365109/using-o-rdwr-vs-o-rdonly-o-wronly#19365248
http://stackoverflow.com/questions/15739490/should-use-size-t-or-ssize-t#15739705
https://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html
File added
\documentclass{ti2}
% line41 rbp * rax = 0xfffffffdf48 * 0xfffffffdf58 = 0xF.FFFFFFBEA×10^21
\usepackage[utf8]{inputenc}
\begin{document}
% Nr, Abgabedatum, Gruppenleiter, Gruppenname, Name1...Name4
\Abgabeblatt{6}{12.12.2016}{Arian Mehrfard}{E08}%
{Sina Ganbar-Haidary}{Collins Audrey Souop Tagne}%
{Alexander Link}{Tammo Wübbena}%
\section*{Aufgabe 1}
\section*{Aufgabe 2}
\section*{Aufgabe 3}
\newpage
\section*{QUELLEN}
\begin{verbatim}
http://pubs.opengroup.org/onlinepubs/007908775/xsh/systypes.h.html
http://stackoverflow.com/questions/19365109/using-o-rdwr-vs-o-rdonly-o-wronly#19365248
http://stackoverflow.com/questions/15739490/should-use-size-t-or-ssize-t#15739705
https://www.gnu.org/software/libc/manual/html_node/Permission-Bits.html
\end{verbatim}
\end{document}
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{ti2}[2009/10/27 Ingo Sieverdingbeck]
\LoadClass[a4paper]{scrartcl}
% -----------------------------------------------------------------------
% Required packages
\RequirePackage[ngerman]{babel}
\RequirePackage{amssymb}
\RequirePackage{epsfig}
\RequirePackage{graphicx}
\RequirePackage{moreverb}
\RequirePackage{parskip}
% -----------------------------------------------------------------------
% define page layout using typearea
\KOMAoptions{headinclude=true}
\KOMAoptions{footinclude=true}
\areaset{16cm}{27cm}
% -----------------------------------------------------------------------
% define page style
\pagestyle{plain}
\thispagestyle{plain}
% -----------------------------------------------------------------------
% Macro für das Abgabeblatt
\newcommand{\Abgabeblatt}[8]
{\Arbblatt{#1}{#2}{#3}{#4}{#5}{#6}{#7}{#8}{\"Ubungsblatt}}
\newcommand{\grenzop}[3]{\mathop{#1}\limits^{#2}_{#3}}
\newcommand{\langrechtspfeil}[2]{\grenzop{\longrightarrow}{#1}{#2}}
\newcommand{\bob}[0]{\hspace*{\fill}$\Box$}
% -----------------------------------------------------------------------
\newcommand{\Arbblatt}[9]
{
\begin{tabular}[t]{lr}
\begin{tabular}[t]{l}
Technische Informatik 2\hspace{20ex} WS 2016/17\\ Tutor: {#3}\\ \hspace{70ex} \\
{\Huge\textsf{{#9} {#1}}} \hspace{10ex} \begin{tabular}{c|c|c|c|c|c}1&2&3&4&5&$\sum$\\\hline &&&&&\end{tabular}\\[1.5ex]
{\Large L\"osungsvorschlag} \\[1ex]
{\Large Abgabe: {#2}} \\[1ex]
\end{tabular}
&
\begin{tabular}[t]{l}
{#4}\\\\
{#5}\\
{#6}\\
{#7}\\
{#8}\\
\end{tabular} \\[2ex]
\end{tabular}\\
\rule{\linewidth}{1pt}
}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment