unsigned char buffer[1000]
while(buffer < 0)
num = fread(buffer,1, 1000, original_pointer);
fwrite(buffer,1,num,copy_pointer);
if(buffer > 1000)
{
//this is the place where i am stuck if the buffer exceeds how do i clear it then carry on reading and writing to a file ?
moroccanplaya
0
Junior Poster
Recommended Answers
Jump to PostJust fill the buffer back up and use the resulting count. The previous contents will be overwritten:
#include <stdio.h> #include <stdlib.h> int main(void) { FILE *in = fopen("test.txt", "r"); char buffer[10]; size_t n; if (in == NULL) { perror(NULL); return EXIT_FAILURE; } while ((n = fread(buffer, 1, …
All 4 Replies
Narue
5,707
Bad Cop
Team Colleague
moroccanplaya
commented:
genius thats what all im going to say, shes my life saver
+1
moroccanplaya
0
Junior Poster
Adak
419
Nearly a Posting Virtuoso
moroccanplaya
commented:
explains stuff verywell, and he is one clever guy
+1
moroccanplaya
0
Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.