Guys, I fail hard at file I/O in C. What I'm trying to do is this:
Open the file
Read the first six bytes of the file
Compare it to blah, where blah is a character array
If it equals blah, do this stuff, otherwise
Shift forward one byte in the file and repeat.
The shifting part is kind of like a queue: basically, you go from FILE[0-5] to FILE[1-6] then FILE[2-7] and so on and so forth until EOF.
Can someone help me? In b4 forced indentation, Ruby on Rails, Opera, do your own homework, etc.
what do you mean by bytes? does stdio even do that?
Name:
Anonymous2007-03-02 19:36 ID:VjfPTWAV
Fuck OO. GOTO or GTFO.
Name:
Anonymous2007-03-02 19:43 ID:Qnb1ykBf
I guess you just mean characters?
Basically just acquaint yourself with fseek and fgets:
fseek (the_file_stream, -4, SEEK_CUR) would set you to the point for the next read after an fgets(string, 6, the_file_stream). Throw those together in a while construction and you should be set.
Name:
Anonymous2007-03-02 19:46 ID:vee8EO+m
char buf[6];
FILE* f = fopen("file", "rb");
if (fread(buf, 1, sizeof buf, f) == 6 && memcmp(buf, "nigger", sizeof buf) == 0)
memmove(buf, buf + 1, sizeof buf - 1)
buf[5] = fgetc(f); //feel free to give a shit about EOF
The religious tard gets trolled and all your shitty memes No one talks about programming on paper or does this mean that it is about as good as i read yours you would have no problem with wave s of shit that pass for browsers like!
Name:
Anonymous2012-03-23 23:40
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boyAll work and no play makes Jack a dull boy
Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy