User Profile

Collapse

Profile Sidebar

Collapse
john eipe
john eipe
Last Activity: Mar 22 '11, 03:24 PM
Joined: Feb 19 '11
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • john eipe
    started a topic buffer confusion
    in C

    buffer confusion

    Hi

    Could anyone clarify on the types of buffers used by a program?

    For eg:

    I have a C program that reads from a stdin to stdout.

    What are the buffers involved here? I'm aware that there are 2.
    One provided by the kernel on which a user don't have any control.
    One provided with standard streams namely stdout, stdin and stderr. Each having a separate buffer.

    ...
    See more | Go to post

  • john eipe
    started a topic reading a file that doesn't exist
    in C

    reading a file that doesn't exist

    Hi,

    I have got a small program that prints the contents of files using the system call - read.

    Code:
    	unsigned char buffer[8];
    	size_t offset=0;
    	size_t bytes_read;
    
    	int i;
    
    	int fd = open(argv[1], O_RDONLY);
    	
    	do{
    		bytes_read = read(fd, buffer, sizeof(buffer));
    		printf("0x%06x : ", offset);
    	
    		for(i=0; i<bytes_read;
    ...
    See more | Go to post
No activity results to display
Show More
Working...