08-05-2006
Hello World Program
I'm trying to compile and run the following program:
[File: hello/hello.c]
#include <stdio.h>
int main ()
{
printf("Hello World\n");
return (0);
}
This is what I'm getting in Terminal:
[localhost:~/learning_c] aaron% cc -g -ohello hello.c
hello.c:1: error: parse error before '[' token
[localhost:~/learning_c] aaron%
Any tips?
I'm running OSX 10.4.7 by the way.
7 More Discussions You Might Find Interesting
1. Solaris
just wanted to give salutations to all in here.
i hope to contribute as much as i take.
happy "unix-ing" :b: (0 Replies)
Discussion started by: JeepResQ
0 Replies
2. UNIX for Dummies Questions & Answers
Hi,
i want to write a script that executes a program (exec?) .
this program then requires a filename as input.
how do i give it this input in the script so the program will be complete run and close by the script.
e.g.
exec prog.exe
program then asks for filename
"enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies
3. What is on Your Mind?
What does the world need now.... ???
Feel free to suggest new items to the poll .... we might add them :) (25 Replies)
Discussion started by: Neo
25 Replies
4. Homework & Coursework Questions
Long story short: I'm working inside of a Unix SSH under a bash shell. I have to code a C program that generates a random number. Then I have to call the compiled C program with a Perl program to run the C program 20 times and put all the generated random #s into a text file, then print that text... (1 Reply)
Discussion started by: jdkirby
1 Replies
5. Programming
Hello!
I have a question to native English-speaking people. In the popular program's "hello world" greeting, what meaning the "world" has: "all", "everybody", "people", "friends" or "whole world", "planet", "Earth", "Universe"?
In other words, to whom this greeting is addressed: to the... (14 Replies)
Discussion started by: Eugene Muzychen
14 Replies
6. Shell Programming and Scripting
I created a program, so a kid can practice there math on it. It dispenses varies math problems and the kid must input an answer. I also want it to grade the work they have done, but I can't find the best place for it to print out the grade.
I have:
if ( $response =~ m/^/ ) {
$user_wants_to_quit... (1 Reply)
Discussion started by: germany1517
1 Replies
7. What is on Your Mind?
This is an excellent video comment on modern society and the remix is good too:
https://www.youtube.com/watch?v=5DU1B_XkyIk
5DU1B_XkyIk
Watch the video above and post your comments. (3 Replies)
Discussion started by: Neo
3 Replies
LEARN ABOUT PHP
maxdb_get_host_info
MAXDB_GET_HOST_INFO(3) 1 MAXDB_GET_HOST_INFO(3)
maxdb_get_host_info - Returns a string representing the type of connection used
Procedural style
SYNOPSIS
string maxdb_get_host_info (resource $link)
DESCRIPTION
Object oriented style
string$maxdb->host_info ()
The maxdb_get_host_info(3) function returns a string describing the connection represented by the $link parameter is using.
RETURN VALUES
A character string representing the server hostname and the connection type.
EXAMPLES
Example #1
Object oriented style
<?php
$maxdb = new maxdb("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
/* print host information */
printf("Host info: %s
", $maxdb->host_info);
/* close connection */
$maxdb->close();
?>
Example #2
Procedural style
<?php
$link = maxdb_connect("localhost", "MONA", "RED", "DEMODB");
/* check connection */
if (maxdb_connect_errno()) {
printf("Connect failed: %s
", maxdb_connect_error());
exit();
}
/* print host information */
printf("Host info: %s
", maxdb_get_host_info($link));
/* close connection */
maxdb_close($link);
?>
The above example will output something similar to:
Host info: localhost
SEE ALSO
maxdb_get_proto_info(3).
PHP Documentation Group MAXDB_GET_HOST_INFO(3)