Find the answer to your Linux question:
Results 1 to 3 of 3
Take this pratical example: you must perform I/O operations on the filesystem. Simple, isn't it? OK. Now I have two choices... use fopen, fclose, fread (library routines), or use counterpart ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401

    Library calls or system calls... porting question


    Take this pratical example: you must perform I/O operations on the filesystem. Simple, isn't it?

    OK. Now I have two choices... use fopen, fclose, fread (library routines), or use counterpart system calls like open, close, read...

    Why I have to choose one method to another? I can imagine that's system calls have less overhead respect the library routines, but how are them portable?
    If I would like to port my program whic uses system call, wich problem I can encounter?
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,844
    If you're looking for portability, then use standard calls all the way.

    Are you using C or C++? If you have access to streams and the >>/<< operations, then you might want to consider using those instead. As a rule of thumb, you should write code to be maintainable/readable and portable first and worry about performance issues when you have a performance issue.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401

    Using C...

    I use C!!! At the moment I've never needed C++...

    Thanks!
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •