× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Pardon my ignorance. I just can't seems to be able to figure out why
this will not compile:

#include <string.h>
#include <unistd.h>

char hostName[256];
int hostNameLen;

hostNameLen = sizeof(hostName);

gethostname(hostName, hostNameLen);

exit(0);




Below is portion of the compiler error:
4 |

5 | char hostName[256];

6 | int hostNameLen;

7 |

8 | hostNameLen = sizeof(hostName);

===========>
.a......................................................................
..........
*=ERROR===========> a - CZM0273 Missing type in declaration of
hostNameLen.
9 |

10 | gethostname(hostName, hostNameLen);

===========>
.a......................................................................
..........
*=ERROR===========> a - CZM0273 Missing type in declaration of
gethostname.
*=SEVERE==========> a - CZM0282 The type of the parameters must be
specified in a prototype.
11 |

12 | exit(0);

===========>
.b....a.................................................................
..........
*=SEVERE==========> a - CZM0275 Unexpected text integer constant
encountered.
*=ERROR===========> b - CZM0273 Missing type in declaration of exit.

* * * * * E N D O F S O U
R C E * * * * *?

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.