NO

Author Topic: what is include file for primitives creat write close  (Read 3740 times)

duffyfr

  • Guest
what is include file for primitives creat write close
« on: March 14, 2010, 04:37:48 AM »
Am attempting to port some C programs from Linux system over to Windows 7 Ultimate 64.
These compile and run without error on newest GNU C, Fedora 12.

I receive the following errors for the following "primitive calls":
Missing prototype for 'write'
Missing prototype for 'creat'
Missing prototype for 'close

I am unable to locate the correct include file.
Current I am using:
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

Thank you

Frank


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: what is include file for primitives creat write close
« Reply #1 on: March 14, 2010, 08:41:08 AM »
From help:

Syntax:
int _creat(const char *name, int mode);

 

Declared in:
<io.h>

<fcntl.h>    (macros)


Use compiler option 'Define compatibility names' -Go


May the source be with you

duffyfr

  • Guest
Re: what is include file for primitives creat write close
« Reply #2 on: March 14, 2010, 06:24:43 PM »
thanks for the assistance.

Tried adding io.h  and this did not fix things.

Is this syntax inside "main" still valid?:

fd=open(d_file_nam, O_BINARY|O_CREAT);
if (fd <= 0)
     {
     printf("Could not create beam data outfile %s, exiting!\n", d_file_nam);
     }; 

Also, what is the meaning of the compiler instruction you suggested in this case?

Frank


Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: what is include file for primitives creat write close
« Reply #3 on: March 14, 2010, 07:43:55 PM »
If you are using POIDE:
From menu Project -> Project options... -> Tab Compiler and check option Define compatibility names.
This insert compiler option -Go to project file.

Or insert that option -Go to compilers commandline.
May the source be with you

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: what is include file for primitives creat write close
« Reply #4 on: March 14, 2010, 08:46:21 PM »
Also, what is the meaning of the compiler instruction you suggested in this case?

You use open(), but the function actually is _open().

Setting the compiler to use compatibility names will allow you to use open() without the leading underscore in your code.
---
Stefan

Proud member of the UltraDefrag Development Team

duffyfr

  • Guest
Re: what is include file for primitives creat write close
« Reply #5 on: March 15, 2010, 10:24:17 PM »
Thanks for the great information and, of course, it works!

As a researcher I end up programming in C every 2 years or so to facilitate a string of analyses and I always seem to end getting caught in new "standards".

(1) What is the best resource to find my own answers to issues like open() (which is portrayed like this in nearly every text)  and _open(). 
(2)  does the preceding "_" signify that this is an externally defined variable?
(3) I tried hard to find out why the function "strcasecmp()" is not now recognized but ran across a possible answer:
                  #define strcasecmp _stricmp       but is there no a standard/updated place to search for answers to such apparent changes in C?
(4) Specifically if I have an externally defined function, how can I easily determine the latest and correct/defining include file?

Thanks again.

Frank
 

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: what is include file for primitives creat write close
« Reply #6 on: March 15, 2010, 10:59:13 PM »
Questions 1 to 3 can be answered by reading the help file, which describes the C standard used and the functions differing from the used C standard, which are usually preceded by an underscore.

For question 4 you will have to look the function up at the MSDN Library or the development kit homepage of the third-party DLL you use.
---
Stefan

Proud member of the UltraDefrag Development Team

duffyfr

  • Guest
Re: what is include file for primitives creat write close
« Reply #7 on: March 16, 2010, 01:31:37 AM »
Thank you all for your help!

I conclude at this point.

Frank

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: what is include file for primitives creat write close
« Reply #8 on: March 16, 2010, 11:01:56 AM »
In oldnames.lib are _strcasecmp and _strncasecmp.

With this Add-In you can list functions from oldnames.lib

http://forum.pellesc.de/index.php?topic=1079.0

Attachment: OldNames.lst
May the source be with you