Welcome to the forum 👋, Guest

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.

  • PËRSHËNDETJE VIZITOR!

    Nëse ju shfaqet ky mesazh do të thotë se ju nuk jeni regjistruar akoma. Anëtarët e rregjistruar kanë privilegjin të marrin pjesë në tema të ndryshme si dhe të komunikojnë me anëtarët e tjerë. Bëhu pjesë e forumit Netedy.com duke u REGJISTRUAR këtu ose nëse ke një llogari KYCU. Komunikim alternative i ketij forumi me vajza dhe djem nga te gjithe trevat shqiptare? Hyr ne: CHAT SHQIP.

Krijimi i nje file te ri ne Linux

centos

ⓃⒺⓉⒺⒹⓎ.ⒸⓄⓂ
ANETAR ✓
Regjistruar më
Dhj 13, 2004
Mesazhe
39,937
Code:
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>

char* program_name;

void system_error(char* cause, int exit_code)
{
fprintf(stderr,"%s: %s: %s\n",program_name,cause, (char*) strerror(errno));
exit(exit_code);
}


int main(int argc, char **argv)
{
if(argc != 2)
{
printf("Usage: %s <filename>\n",argv[0]);
exit(EXIT_FAILURE);
}
program_name = argv[0];
/* Permisions for the new file */
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH;

/* filename for the new file */
char* filename = argv[1];

/* Create a new file */
int fd = open(filename,O_CREAT | O_EXCL,mode);
if(fd == -1)
{
system_error("open",EXIT_FAILURE);
}

exit(EXIT_SUCCESS);
}
 

Postime të reja

Theme customization system

You can customize some areas of the forum theme from this menu.

Choose the color combination according to your taste

Select Day/Night mode

You can use it by choosing the day and night modes that suit your style or needs.

Welcome to the forum 👋, Guest

To access the forum content and all our services, you must register or log in to the forum. Becoming a member of the forum is completely free.