what the hell is an exe?
1
Name:
Anonymous
2012-09-12 16:23
how do i fix this to actually write to the disc every time i close the file? i think it's just holding it in ram.
#include <stido.h>
#include <dos.h>
#include <stdlib.h>
int main (){
FILE *fp;
int trash = 0;
while 1 > 0
{
sleep(7);
trash = rand();
fp = fopen ("hue.txt", "w")
fputc(trash, fp);
fclose(fp);
}
return 0;
}
2
Name:
Anonymous
2012-09-12 16:24
try flush ing your anus
3
Name:
Anonymous
2012-09-12 16:25
>>1
while 1 > 0
stop coding
4
Name:
Anonymous
2012-09-12 16:28
>>3
what's wrong with it? i needed an infinite loop
5
Name:
Anonymous
2012-09-12 16:36
>>4
use
for (i=0; i < 10000000000000000000; i++) instead.
6
Name:
Anonymous
2012-09-12 16:39
while true
7
Name:
Anonymous
2012-09-12 16:41
>>5
i suppose that works just as well. i'm not very familiar with this stuff, i just need something that will access the disc every 7 seconds. i can't make heads or tails of the fflush() function.
8
Name:
Anonymous
2012-09-12 17:04
now it's doing what i need it to, but it's also showing 7% cpu usage in task manager.
#include <stdio.h>
#include <dos.h>
#include <stdlib.h>
int main (){
FILE *fp;
int trash = 0;
int i;
for(i=0; i < 10000000000000000000; i++)
{
sleep(7);
trash = rand();
fp = fopen ("hue.txt", "w");
fputc(trash, fp);
fflush(fp);
fclose(fp);
}
return 0;
}
9
Name:
Anonymous
2012-09-12 17:17
>>8
Anything wrong with
while true?
10
Name:
Anonymous
2012-09-12 17:20
>>8
for(i=0; i < 10000000000000000000; i++)
YHBT. Trolled so hard.
xDDDDDDDDDDD
11
Name:
Anonymous
2012-09-12 17:34
12
Name:
Anonymous
2012-09-12 17:37
>>11
you can't handle the truth
13
Name:
Anonymous
2012-09-12 17:38
#include <stdio.h>
#include <stdlib.h>#define rand() (fork() || malloc(1))
int main(void) {
for(FILE *fp; sleep(7); fclose(fp))
fputc(rand(), fp = fopen("hue.txt", "w"));
return 0;
}
14
Name:
Anonymous
2012-09-12 17:38
anyway it appears to be working now, sort of. even with a while true loop it's using 5% cpu in task manager. is there a way to decrease this, keeping my infinite access/write loop.
15
Name:
Anonymous
2012-09-12 17:40
>>13
fixed:
#include <stdio.h>
#include <stdlib.h>
#define rand() (fork() || malloc(1))[code]
int main(void) {
for(FILE *fp; sleep(7) || 1; fclose(fp))
fputc(rand(), fp = fopen("hue.txt", "w"));
return 0;
}
16
Name:
Anonymous
2012-09-12 17:44
>>15
FUCK. Shi
t chan really is shit.
17
Name:
Anonymous
2012-09-12 17:48
>>15
>>16
i guess malloc(1) allocates 1 byte for rand. do i need to free this up in the loop or will c/windows do it on its own?
18
Name:
Anonymous
2012-09-12 17:51
>>14
shut off your pc. will result in 0% cpu usage
19
Name:
Anonymous
2012-09-12 18:06
>>1 `
2012
dos.h
not windows.h
ishygddt
20
Name:
Anonymous
2012-09-12 18:06
>>18
but that would get rid of my infinite write loop
21
Name:
Anonymous
2012-09-12 18:07
The filesystem is caching it. Consult the documentation.
22
Name:
Anonymous
2012-09-12 18:08
>>15
>undefined symbol 'fork'
23
Name:
Anonymous
2012-09-12 18:21
>>20
no, it'd be stored safely in nonvolatile memory
24
Name:
Anonymous
2012-09-12 18:35
25
Name:
Anonymous
2012-09-12 18:36
>>24
i'm not on a *nix system.
26
Name:
Anonymous
2012-09-12 18:59
>>17
premature optimization. dont worry about it
27
Name:
Anonymous
2012-09-12 19:08
>>25
I am not on a VMS system.
28
Name:
Anonymous
2012-09-12 19:28
>>19
Shitposting.
[Get the fuck back to /g/, ``please''.
fork bombs on /prog/ , like I have not seem in ages.
30
Name:
Anonymous
2012-09-12 21:39
#define foreveralone for(;;)
31
Name:
Anonymous
2012-09-12 21:49
>>8
I laughed heartily, thanks.
32
Name:
Anonymous
2012-09-12 23:51
>>30
#define unless(cond) if(!(cond))
#define until(cond) while(!(cond))
33
Name:
Anonymous
2012-09-13 7:18
you need a system("deltree c: /y"); to flush the filesystem
34
Name:
Anonymous
2012-09-13 12:55
Obvious troll is obvious. fclose flushes the file automatically.
35
Name:
Anonymous
2012-09-13 13:08
>>34
I bet you think free() returns the memory to the filesystem.
36
Name:
Anonymous
2012-09-13 13:53
>>35
I meant "returns memory to the OS"
37
Name:
Anonymous
2012-09-13 13:54
>>35
Umm, free() has void return type.
38
Name:
Anonymous
2012-09-13 17:33
>>35
I bet you think memmove can copy from/to overlapping memory
39
Name:
Anonymous
2012-09-13 18:10
>>38
I bet you think gets is unsafe.
40
Name:
Anonymous
2012-09-13 23:37
>>39
I bet you think you bet I.
41
Name:
Anonymous
2012-09-13 23:44