linux c library function to read binary file code

linux c library function to read binary file code

struct person
    int id;
    char name[20];
    int age;
    int sex;
    char tel[20];

int main(int arg, char *args[])
    FILE *p = fopen(args[1], "w");
    if (p == NULL)
        printf("error is %s\n", strerror(errno));
    } else
        struct person man;
        memset(&man, 0 ...

Continue reading

Linux command history

[root@linux ~]# history [n]
[root@linux ~]# history [-c]
[root@linux ~]# history [-raw] histfiles


-n  :number, meaning ' the n command to list the most recent list ' means!

-c  :All the history in the current shell delete all content

-a  :Will be added into the history currently added instruction in histfiles, if not histfiles, then the ...

Continue reading

virtualenv -- python Virtual Environment

1. Installation pip

 pip install virtualenv

2. Creating a Virtual Environment

virtualenv envfolder(Virtual environment name)

3. Start Virtual Environment

After you create a successful, will generate the corresponding directory files in the current directory.

cd envfolder/

Then start

source ./bin/activate

4.Quit Virtual Environment


fedora mysql root Password Reset

1.Stop mysql service

[root@localhost han]#/etc/init.d/mysqld stop
Stop MySQL: [OK]

2.Start mysql service with the following command

[root@localhost han]#mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

(Prompt message: [root@localhost han]# nohup: ignoring input and redirecting stderr to stdout Starting mysqld daemon with databases from /var/lib/mysql)

3 ...

Continue reading

linux vps iptables Firewall configuration shell

echo "clean all rules before"
iptables -F
iptables -X

echo "setting up default rules"
iptables -P INPUT ACCEPT

echo "allow local address"
iptables -A INPUT -i lo -p all -j ACCEPT

echo "allow now connection"
iptables -A INPUT -p all -m state --state ESTABLISHED,RELATED ...

Continue reading

CentOS yum upgrade Python 2.6 to 2.7

CentOS system comes python2.6.6 by yum upgrade to python2.7

1.Install Upgrade
rpm -ivh nux-dextop-release-0-2.el6.nux.noarch.rpm ...

Continue reading

Yearly archives