#include #include #include #include int main(int argc, char *argv[]){ if(argc < 2){ fprintf(stderr, "Usage %s filename\n", argv[0]); return 1; } //Open file to write //Try CREAT and TRUNC vs APPEND options int fd = open(argv[1], O_WRONLY| O_TRUNC | O_CREAT, 0666); if (fd < 0) { fprintf(stderr,"Could not open file %s: ",argv[1]); perror("ERROR"); return 1; } char c ='A'; write(fd, &c, 1); close(fd); return 0; }