Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * File: main.cpp
- * Author: felix
- *
- * Created on 6. November 2010, 15:09
- */
- #include <stdlib.h>
- #include <iostream>
- #include <fcntl.h> //für die open() funktion
- #include <cstdio> //für die fprintf() funktion
- #include <unistd.h> //für read/write funktion
- #define BUFSIZE 2352
- using namespace std;
- /*
- *
- */
- int main(int argc, char** argv) {
- int image, cd, tmp;
- char buf[BUFSIZE];
- //Open
- //---------------------------------------------------------
- if ((cd = open("/dev/cdrom", O_RDONLY)) < 0) {
- fprintf(stderr, "open error\n");
- exit(2);
- } else {
- printf("Open succeeded! \n");
- }
- //Iso erstellen
- //---------------------------------------------------------
- if ((image = creat("cdimage.iso", 0777)) < 0) {
- fprintf(stderr, "create error\n");
- exit(1);
- }
- //daten von CD in image Datei kopieren
- //---------------------------------------------------------
- while ((tmp = read(cd, buf, BUFSIZE)) > 0) {
- write(image, buf, BUFSIZE);
- }
- printf("fertig!\n");
- return (EXIT_SUCCESS);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement