Learn Linux C programming starting from 0

Source: Internet
Author: User
Tags include printf ssh ssh secure shell linux

I am using Sshsecureshellclient-3[1].2.9.exe for Linux C programming on Windows XP-SP2, let's talk about how to use this software first:

Install Sshsecureshellclient-3[1].2.9.exe locally, create a username and password on the server, and then open the SSH Secure Shell client,enter key or click Quick Connect to enter the target (I don't understand , barking) IP, enter user name, enter key, enter password. Now you should have entered Linux, where all the Linux commands can be used, beginners may want to knock a few common commands to try!

From the simplest hello word to the more complex library references, of course how to write generic makefile is limited to the level, without discussion.

1, Hello Word

1), the procedure:

#include <stdio.h>

int main (void)
{
printf ("Hello, word\n");

return 0;
}

Name is HELLOWORD.C

2), Operation:

Go into the SSH Secure Shell Client and use the CD path name to enter the directory where your HELLOWORD.C resides,

Then Gcc-o Helloword HELLOWORD.C, the following will show the compilation of the situation, there are errors and warnings will be listed, no will not appear and return to the directory you just entered, to run the input./helloword, so you'll see Hello, word

2, compile multiple. C and. h Files of the program, then need to write makefile

1), the procedure:

#include "mytool1.h"
#include "mytool2.h"
int main(int argc,char **argv)
{
mytool1_print("hello");
mytool2_print("hello");
}

Name is MAIN.C

#include "mytool1.h"
void mytool1_print(char *print_str)
{
printf("This is mytool1 print %s\n",print_str);
}

Name is mytool1.c

#ifndef _MYTOOL_1_H
#define _MYTOOL_1_H
void mytool1_print(char *print_str);
#endif

Name is Mytool1.h

#include "mytool2.h"
void mytool2_print(char *print_str)
{
printf("This is mytool2 print %s\n",print_str);
}

Name is mytool2.c

#ifndef _MYTOOL_2_H
#define _MYTOOL_2_H
void mytool2_print(char *print_str);
#endif

Name is Mytool2.h

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.