-
Notifications
You must be signed in to change notification settings - Fork 0
/
fbcopy.c
31 lines (29 loc) · 834 Bytes
/
fbcopy.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* Copyright (C) 2014 Tomasz Kramkowski <[email protected]>
*
* This program is free software. It is licensed under version 3 of the
* GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see [http://www.gnu.org/licenses/].
*/
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void) {
FILE *fbp = fopen( "/dev/fb0", "r" );
if (!fbp)
exit(1);
puts("Opened framebuffer for reading.");
FILE *outfile = fopen( "/home/main/c-stuff/fbshot", "w" );
if (!outfile)
exit(1);
puts("Opened outfile for writing.");
char c;
while ( (c = fgetc(fbp)) != EOF )
fputc(c, outfile);
puts("Finished writing to files. Closing.");
fclose(fbp);
fclose(outfile);
puts("Finished.");
}