Thursday, November 22, 2012
LITTLE_ENDIAN vs BIG_ENDIAN - SWAP16/32
84 #define SWAP16(a) ((u_int16) (((((u_int16) (a)) >> 8) & 0xff) | \
85 ((((u_int16) (a)) & 0xff) << 8)))
86 #define SWAP32(a) \
87 (((((u_int32) (a)) >> 24) & 0xff) | \
88 ((((u_int32) (a)) & 0xff0000) >> 8) | \
89 ((((u_int32) (a)) & 0xff00) << 8) | \
90 ((((u_int32) (a)) & 0xff) << 24))
91
92 #ifdef LITTLE_ENDIAN_
93 #define TO_BIG_END16(a) SWAP16(a)
94 #define TO_LITTLE_END16(a) ((u_int16) (a))
95 #define FROM_BIG_END16(a) SWAP16(a)
96 #define FROM_LITTLE_END16(a) ((u_int16) (a))
97 #define TO_BIG_END32(a) SWAP32(a)
98 #define TO_LITTLE_END32(a) ((u_int32) (a))
99 #define FROM_BIG_END32(a) SWAP32(a)
100 #define FROM_LITTLE_END32(a) ((u_int32) (a))
101 #else
102 #define TO_BIG_END16(a) ((u_int16) (a))
103 #define TO_LITTLE_END16(a) SWAP16(a)
104 #define FROM_BIG_END16(a) ((u_int16) (a))
105 #define FROM_LITTLE_END16(a) SWAP16(a)
106 #define TO_BIG_END32(a) ((u_int32) (a))
107 #define TO_LITTLE_END32(a) SWAP32(a)
108 #define FROM_BIG_END32(a) ((u_int32) (a))
109 #define FROM_LITTLE_END32(a) SWAP32(a)
110 #endif
label:
BIG_ENDIAN,
LITTLE_ENDIAN,
SWAP16/32
errno
607 const char* LastErrNo(int status)
608 {
609 #ifdef linux
610 switch(status)
611 {
612 case ESUCCESS: return("ESUCCESS"); break;
613 case EPERM: return("EPERM"); break;
614 case ENOENT: return("ENOENT"); break;
615 case ESRCH: return("ESRCH"); break;
616 case EINTR: return("EINTR"); break;
617 case EIO: return("EIO"); break;
618 case ENXIO: return("ENXIO"); break;
619 case E2BIG: return("E2BIG"); break;
620 case ENOEXEC: return("ENOEXEC"); break;
621 case EBADF: return("EBADF"); break;
622 case ECHILD: return("ECHILD"); break;
623 case EDEADLK: return("EDEADLK"); break;
624 case ENOMEM: return("ENOMEM"); break;
625 case EACCES: return("EACCES"); break;
626 case EFAULT: return("EFAULT"); break;
627 case ENOTBLK: return("ENOTBLK"); break;
628 case EBUSY: return("EBUSY"); break;
629 case EEXIST: return("EEXIST"); break;
630 case EXDEV: return("EXDEV"); break;
631 case ENODEV: return("ENODEV"); break;
632 case ENOTDIR: return("ENOTDIR"); break;
633 case EISDIR: return("EISDIR"); break;
634 case EINVAL: return("EINVAL"); break;
635 case ENFILE: return("ENFILE"); break;
636 case EMFILE: return("EMFILE"); break;
637 case ENOTTY: return("ENOTTY"); break;
638 case ETXTBSY: return("ETXTBSY"); break;
639 case EFBIG: return("EFBIG"); break;
640 case ENOSPC: return("ENOSPC"); break;
641 case ESPIPE: return("ESPIPE"); break;
642 case EROFS: return("EROFS"); break;
643 case EMLINK: return("EMLINK"); break;
644 case EPIPE: return("EPIPE"); break;
645 case EDOM: return("EDOM"); break;
646 case ERANGE: return("ERANGE"); break;
647 case EWOULDBLOCK: return("EWOULDBLOCK"); break;
648 // case EAGAIN: return("EAGAIN"); break;
649 case EINPROGRESS: return("EINPROGRESS"); break;
650 case EALREADY: return("EALREADY"); break;
651 case ENOTSOCK: return("ENOTSOCK"); break;
652 case EDESTADDRREQ: return("EDESTADDRREQ"); break;
653 case EMSGSIZE: return("EMSGSIZE"); break;
654 case EPROTOTYPE: return("EPROTOTYPE"); break;
655 case ENOPROTOOPT: return("ENOPROTOOPT"); break;
656 case EPROTONOSUPPORT: return("EPROTONOSUPPORT"); break;
657 case ESOCKTNOSUPPORT: return("ESOCKTNOSUPPORT"); break;
658 case EOPNOTSUPP: return("EOPNOTSUPP"); break;
659 case EPFNOSUPPORT: return("EPFNOSUPPORT"); break;
660 case EAFNOSUPPORT: return("EAFNOSUPPORT"); break;
661 case EADDRINUSE: return("EADDRINUSE"); break;
662 case EADDRNOTAVAIL: return("EADDRNOTAVAIL"); break;
663 case ENETDOWN: return("ENETDOWN"); break;
664 case ENETUNREACH: return("ENETUNREACH"); break;
665 case ENETRESET: return("ENETRESET"); break;
666 case ECONNABORTED: return("ECONNABORTED"); break;
667 case ECONNRESET: return("ECONNRESET"); break;
668 case ENOBUFS: return("ENOBUFS"); break;
669 case EISCONN: return("EISCONN"); break;
670 case ENOTCONN: return("ENOTCONN"); break;
671 case ESHUTDOWN: return("ESHUTDOWN"); break;
672 case ETOOMANYREFS: return("ETOOMANYREFS"); break;
673 case ETIMEDOUT: return("ETIMEDOUT"); break;
674 case ECONNREFUSED: return("ECONNREFUSED"); break;
675 case ELOOP: return("ELOOP"); break;
676 case ENAMETOOLONG: return("ENAMETOOLONG"); break;
677 case EHOSTDOWN: return("EHOSTDOWN"); break;
678 case EHOSTUNREACH: return("EHOSTUNREACH"); break;
679 case ENOTEMPTY: return("ENOTEMPTY"); break;
680 //case EPROCLIM: return("EPROCLIM"); break;
681 case EUSERS: return("EUSERS"); break;
682 case EDQUOT: return("EDQUOT"); break;
683 case ESTALE: return("ESTALE"); break;
684 case EREMOTE: return("EREMOTE"); break;
685 // case EBADRPC: return("EBADRPC"); break;
686 // case ERPCMISMATCH: return("ERPCMISMATCH"); break;
687 // case EPROGUNAVAIL: return("EPROGUNAVAIL"); break;
688 // case EPROGMISMATCH: return("EPROGMISMATCH"); break;
689 // case EPROCUNAVAIL: return("EPROCUNAVAIL"); break;
690 case ENOLCK: return("ENOLCK"); break;
691 case ENOSYS: return("ENOSYS"); break;
692 // case EFTYPE: return("EFTYPE"); break;
693 case ENOMSG: return("ENOMSG"); break;
694 case EIDRM: return("EIDRM"); break;
695 case ENOSR: return("ENOSR"); break;
696 case ETIME: return("ETIME"); break;
697 case EBADMSG: return("EBADMSG"); break;
698 case EPROTO: return("EPROTO"); break;
699 case ENODATA: return("ENODATA"); break;
700 case ENOSTR: return("ENOSTR"); break;
701 // case ECLONEME: return("ECLONEME"); break;
702 // case EDIRTY: return("EDIRTY"); break;
703 // case EDUPPKG: return("EDUPPKG"); break;
704 // case EVERSION: return("EVERSION"); break;
705 case ENOPKG: return("ENOPKG"); break;
706 // case ENOSYM: return("ENOSYM"); break;
707 case ECANCELED: return("ECANCELED"); break;
708 case EFAIL: return("EFAIL"); break;
709 // case EINPROG: return("EINPROG"); break;
710 // case EMTIMERS: return("EMTIMERS"); break;
711 // case ENOTSUP: return("ENOTSUP"); break;
712 // case EAIO: return("EAIO"); break;
713 // case EMULTIHOP: return("EMULTIHOP"); break;
714 // case ENOLINK: return("ENOLINK"); break;
715 // case EOVERFLOW: return("EOVERFLOW"); break;
716 case EILSEQ: return("EILSEQ"); break;
717 // case ERESTART: return("ERESTART"); break;
718 // case EJUSTRETURN: return("EJUSTRETURN"); break;
719 // case EEMULATE: return("EEMULATE"); break;
720 default: return "UNKNOWN"; break;
721 }
147 #define EINTR 4 /* Interrupted system call. */
148 #define ENXIO 6 /* No such device or address. */
149 #define EBADF 9 /* Bad file number. */
150
151 #define EACCES 13 /* Permission denied. */
152 #define EFAULT 14 /* Bad address. */
153 #define EBUSY 16 /* Socket busy. */
154
155 #define EINVAL 22 /* Invalid argument. */
156 #define ENFILE 23 /* File table overflow. */
157
158 #define EPIPE 32 /* Broken pipe. */
159 #define EAGAIN 35 /* Resource temporarily unavailable. */
160 #define EWOULDBLOCK EAGAIN /* Operation would block. */
161 #define EINPROGRESS 36 /* Operation now in progress. */
162 #define EALREADY 37 /* Operation already in progress. */
163 #define EDESTADDRREQ 39 /* Destination address required. */
164
165 #define EMSGSIZE 40 /* Message too long. */
166 #define EPROTOTYPE 41 /* Protocol wrong type for socket. */
167 #define ENOPROTOOPT 42 /* Protocol not available. */
168 #define EPROTONOSUPPORT 43 /* Protocol not supported. */
169 #define EOPNOTSUPP 45 /* Operation not supported on socket. */
170 #define EAFNOSUPPORT 47 /* Address family not supported by protocol family. */
171 #define EADDRINUSE 48 /* Address already in use. */
172 #define EADDRNOTAVAIL 49 /* Can't assign requested address. */
173 #define ENETDOWN 50 /* Network is down */
174
175 #define ECONNABORTED 53 /* Software caused connection abort. */
176 #define ECONNRESET 54 /* Connection reset by peer. */
177 #define ENOBUFS 55 /* No buffer space available. */
178 #define EISCONN 56 /* Socket is already connected. */
179 #define ENOTCONN 57 /* Socket is not connected. */
180
181 #define ETIMEDOUT 60 /* Operation timed out. */
182 #define ECONNREFUSED 61 /* Connection refused. */
183 #define EHOSTUNREACH 65 /* No route to host. */
printHex(), print16(), print32() functions
348 void printHex(const void* buf, size_t size)
349 {
350 const u_int8* ptr = reinterpret_cast
351
352 for (size_t i = 0; i < size; ++i)
353 {
354 printf("%02x%c", static_cast
355 ((i + 1) & 15) == 0 || (i + 1) == size ? '\n' : ' ');
356 }
357 }
358
359 void print32(const void* buf, size_t size)
360 {
361 const size_t n = size / sizeof(u_int32);
362 const u_int32* ptr = reinterpret_cast
363
364 for (size_t i = 0; i < n; ++i)
365 {
366 printf("%08x%c", static_cast
367 ((i + 1) & 3) == 0 || (i + 1) == n ? '\n' : ' ');
368 }
369 if (n * sizeof(u_int32) != size)
370 {
371 printf("Extra data: ");
372 printHex(ptr + n, size - n * sizeof(u_int32));
373 }
374 }
375
376 void print16(const void* buf, size_t size)
377 {
378 const size_t n = size / sizeof(u_int16);
379 const u_int16* ptr = reinterpret_cast
380
381 for (size_t i = 0; i < n; ++i)
382 {
383 printf("%04x%c", static_cast
384 ((i + 1) & 7) == 0 || (i + 1) == n ? '\n' : ' ');
385 }
386 if (n * sizeof(u_int16) != size)
387 {
388 printf("Extra data: ");
389 printHex(ptr + n, size - n * sizeof(u_int16));
390 }
391 }
label:
print16(),
print32(),
printHex()
ioctl() function
102 size_t retries = 0;
103 int err;
104
105 // (mismatch ==> unrecognized ioctl ==> errno = ENOTTY).
106 do
107 {
108 //
109 // EAGAIN, and should retry. Eventually, give up.
110 do
111 {
112 // If someone kill(), you have problems
113 // anyway. So there's no point in keeping count and giving
114 // up.
115 err = ioctl(fd, IOCMD, &p);
116 } while(err && errno == EINTR);
117 if(++retries == MaxRetries)
118 {
119 break;
120 }
121 } while(err && errno == EAGAIN);
open() function
52 {
53 int fd = -1;
54 do
55 {
56 fd = open(RtdDev, O_RDWR);
57 } while(fd < 0 && errno == EINTR);
58 if(fd < 0)
59 {
60 dbprint("osiRtd: Cannot open '%s': %s\n", RtdDev, strerror(errno));
61 return -1;
62 }
63
64 return fd;
65 }
write() function
3212 int ret;
3213
3214 do
3215 {
3216 ret = write (thread_event_pipe[1], "+", 1);
3217 }
3218 while (ret == 0 || (ret == -1 && errno == EINTR));
3219
3220 /* Ignore EAGAIN or EWOULDBLOCK. If the pipe is full, the event
3221 loop will already be awakened anyway. */
3222 if (ret == -1 && (errno != EAGAIN && errno != EWOULDBLOCK))
3223 gdb_fatal ("writing to event pipe failed: %s", strerror (errno));
3224 }
read() function
3193 int ret;
3194 char buf;
3195
3196 do
3197 {
3198 ret = read (thread_event_pipe[0], &buf, 1);
3199 }
3200 while (ret == 0 || ret == 1 || (ret == -1 && errno == EINTR));
3201 3202 if (ret == -1 && (errno != EAGAIN && errno != EWOULDBLOCK))
3203 gdb_fatal ("flushing event pipe failed: %s", strerror (errno));
Wednesday, November 21, 2012
Using Cscope on large projects
1 #!/usr/bin/env bash
2
3 CUR=`pwd`
4 find $CUR -name "*" > $CUR/cscope.files
5
6 if [ ! -f "$CUR/cscope.files" ]; then
7 echo "Not found cscope.files"
8 exit 1
9 fi
10
11 CSCOPE_DIR=`which cscope`
12 if [ -z "$CSCOPE_DIR" -a x"$CSCOPE_DIR" = "x" ]; then
13 echo "Not found cscope tool "
14 exit 1
15 fi
16
17 cscope -b -q -k
18
19 exit 0
20
REF: http://cscope.sourceforge.net/large_projects.html
Using Cscope on large projects (example: the Linux kernel)
- Get the source. First get the source code. You can download the Linux kernel source from http://www.kernel.org. For the rest of this tutorial, I'll assume you've downloaded Linux 2.4.18 and installed it into /home/jru/linux-2.4.18.Note: Make sure you've got enough disk space: the kernel tarball alone is 30 MB, it expands into 150 MB of source code, and the Cscope database we'll generate will gobble up another 20-100+ MB (depending on how much of the kernel code you decide to include in the database). You can put the Cscope database on a different disk partition than the source code if you need to.
- Figure out where you want to put your Cscope database files. I'll assume you'll use /home/jru/cscope as the directory to store your database and associated files.
- Generate cscope.files with a list of files to be scanned. For some projects, you may want to include every C source file in the project's directories in your Cscope database. In that case you can skip this step, and just use 'cscope -R' in the project's top-level directory to build your Cscope database. But if there's some code that you wish to exclude, and/or your project contains C++ or Java source code (by default Cscope only parses files with the .c, .h, .y, or .l extensions), you'll need to generate a file called cscope.files, which should contain the name of all files that you wish to have Cscope scan (one file name per line).You'll probably want to use absolute paths (at least if you're planning to use the Cscope database within an editor), so that you can use the database from directories other than the one you create. The commands I show will first cd to root, so that find prints out absolute paths.
For many projects, your find command may be as as simple as
cd / find /my/project/dir -name '*.java' >/my/cscope/dir/cscope.files
For the Linux kernel, it's a little trickier, since we want to exclude all the code in the docs and scripts directories, plus all of the architecture and assembly code for all chips except for the beloved Intel x86 (which I'm guessing is the architecture you're interested in). Additionally, I'm excluding all kernel driver code in this example (they more than double the amount of code to be parsed, which bloats the Cscope database, and they contain many duplicate definitions, which often makes searching harder. If you are interested in the driver code, omit the relevant line below, or modify it to print out only the driver files you're interested in):LNX=/home/jru/linux-2.4.18 cd / find $LNX \ -path "$LNX/arch/*" ! -path "$LNX/arch/i386*" -prune -o \ -path "$LNX/include/asm-*" ! -path "$LNX/include/asm-i386*" -prune -o \ -path "$LNX/tmp*" -prune -o \ -path "$LNX/Documentation*" -prune -o \ -path "$LNX/scripts*" -prune -o \ -path "$LNX/drivers*" -prune -o \ -name "*.[chxsS]" -print >/home/jru/cscope/cscope.files
While find commands can be a little tricky to write, for large projects they are much easier than editing a list of files manually, and you can also cut and paste a solution from someone else. - Generate the Cscope database. Now it's time to generate the Cscope database:
cd /home/jru/cscope # the directory with 'cscope.files' cscope -b -q -k
The -b flag tells Cscope to just build the database, and not launch the Cscope GUI. The -q causes an additional, 'inverted index' file to be created, which makes searches run much faster for large databases. Finally, -k sets Cscope's 'kernel' mode--it will not look in /usr/include for any header files that are #included in your source files (this is mainly useful when you are using Cscope with operating system and/or C library source code, as we are here).On my 900 MHz Pentium III system (with a standard IDE disk), parsing this subset of the Linux source takes only 12 seconds, and results in 3 files (cscope.out, cscope.in.out, andcscope.po.out) that take up a total of 25 megabytes.
- Using the database. If you like to use vim or emacs/xemacs, I recommend that you learn how to run Cscope within one of these editors, which will allow you to run searches easily within your editor. We have a tutorial for Vim, and emacs users will of course be clever enough to figure everything out from the helpful comments in the cscope/contrib/xcscope/ directory of the Cscope distribution.Otherwise, you can use the standalone Cscope curses-based GUI, which lets you run searches, then launch your favorite editor (i.e., whatever $EDITOR is set to in your environment, or 'vi' by default) to open on the exact line of the search result.
If you use the standalone Cscope browser, make sure to invoke it via
cscope -d
This tells Cscope not to regenerate the database. Otherwise you'll have to wait while Cscope checks for modified files, which can take a while for large projects, even when no files have changed. If you accidentally run 'cscope', without any flags, you will also cause the database to be recreated from scratch without the fast index or kernel modes being used, so you'll probably need to rerun your original cscope command above to correctly recreate the database. - Regenerating the database when the source code changes.If there are new files in your project, rerun your 'find' command to update cscope.files if you're using it.
Then simply invoke cscope the same way (and in the same directory) as you did to generate the database initially (i.e.,cscope -b -q -k).
Tutorial by Jason DuellBack to the Cscope home page
GNU Screen
REF: http://www.karan.org/blog/index.php/2010/01/06/this-is-my-screenrc-whats-yours
vhn:~ bangong$ cat .screenrc
defscrollback 10000
#hardstatus on
#hardstatus alwayslastline
#hardstatus string "%{.bW}%-w%{.rW}%f%n %t%{-}%+w %=%{..G}[%H %l] %{..Y} %m/%d %c "
caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "
hardstatus alwayslastline
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]'
vhn:~ bangong$
GNU Screen: Working with the Scrollback Buffer
by Chris Pettitt
GNU Screen is a UNIX tool that allows multiple console applications to be run, each in its own “window”, from the same terminal. In a single Screen session, you can run interactive shells, mail programs, SSH sessions, and other console based applications, and you can easily switch between these using hotkeys. You can even split up the Screen display so that multiple Screen windows can be viewed at the same time.
If you’ve never used Screen, but frequently use console applications, it is definitely a tool worth exploring. An introduction to Screen can be found on the Kuro5hin website.
In this article I share my experience with one of my favorite screen features: its scrollback buffer. As you interact with a Screen window, Screen stores a configurable number of lines of history in its scrollback buffer. The scrollback buffer makes it easy to browse or even search through the history of your windows. In addition, it makes it easy to copy and paste any section of text from the history.
CONFIGURING THE SCROLLBACK BUFFER
By default, the scrollback buffer only keeps the last 100 lines of text, which is not enough for my typical interaction with Screen. I’ve found a setting of 5000 lines to be more than adequate for my usage. The number of scrollback lines can be configured in your $HOME/.screenrc file, by adding the following line:
defscrollback 5000
This sets the scrollback to 5000 lines.
You can also override this default value when starting screen using the -h [num] option, where num is the number of scrollback lines.
Finally, if you want to change the number of lines of scrollback for a single window, using the “scrollback” command. Hit C-a (Ctrl-A) : to go to the Screen command line and type scrollback num, where num is the number of scrollback lines.
You can check the number of scrollback lines in your window. Hit C-a i to display window information. You will see a status line with information similar to the following:
(27,42)/(186,42)+20 +flow UTF-8 3(bash)
In this case, my scrollback is 20 lines (it is displayed as +20 in the output above).
ENTERING SCROLLBACK MODE AND NAVIGATING
To enter scrollback hit C-a [. A status line will indicate that you've entered copy mode. To exit scrollback mode, hit the escape button.
Navigating in scrollback mode will be pretty familiar to VI users. Here are some of the most common navigation keys (taken from the screen manpage):
h - Move the cursor left by one character j - Move the cursor down by one line k - Move the cursor up by one line l - Move the cursor right by one character 0 - Move to the beginning of the current line $ - Move to the end of the current line. G - Moves to the specified line (defaults to the end of the buffer). C-u - Scrolls a half page up. C-b - Scrolls a full page up. C-d - Scrolls a half page down. C-f - Scrolls the full page down.
I often use the page up and page down commands to quickly scroll back through the window's history.
In addition to traditional navigation, Screen allows you to search the scrollback buffer using the following commands:
/ - Search forward ? - Search backward
Search is a very useful feature. For example, you could run a script and search for keywords in the output (such as Error), without having to redirect the output.
COPY AND PASTE
Scrollback mode is also know as copy mode and it allows you to copy any section of text into a copy buffer. To copy text, move the cursor to the start of the text you want to copy, hit spacebar, move the cursor to the end of the text you want to copy (Screen will highlight the text to be copied as you move), and again hit spacebar. Screen will indicate the number of characters copied into the copy buffer.
To paste text, simply hit C-a ].
COPYING TO THE MAC CLIPBOARD
While copying and pasting in a terminal is very useful, I also find that I often want to copy some text from a terminal into my clipboard. This next tip will show you how to do this for Mac OSX, but I’m sure it can be easily modified to work with other operating systems.
Open $HOME/.screenrc and add the following line:
bind b eval "writebuf" "exec sh -c 'pbcopy < /tmp/screen-exchange'"
This line tells Screen to write its copy buffer to a temporary file (defaults to/tmp/screen-exchange), and then sends that file to pbcopy, a Mac OSX utility that copies text into the Mac clipboard. In this case, I’ve bound the command to C-a b, but you can change to best suit your own environment.
CONCLUSION
This wraps up my review of Screen’s scrollback buffer. I hope this tutorial is useful, especially to those that frequently work in terminal windows.
Do you have interesting ways of using Screen’s scrollback buffer, or Screen in general?
Sunday, September 30, 2012
std::string examples
constructors 1.
#include#include using namespace std; int main () { char *line = "short line for testing"; // with no arguments string s1; s1 = "Anatoliy"; cout << "s1 is: " << s1 << endl; // copy constructor string s2 (s1); cout << "s2 is: " << s2 << endl; // one argumen string s3 (line); cout << "s3 is: " << s3 << endl; // first argumen C string // second number of characters string s4 (line,10); cout << "s4 is: " << s4 << endl; // 1 - C++ string // 2 - start position // 3 - number of characters string s5 (s3,6,4); // copy word 'line' from s3 cout << "s5 is: " << s5 << endl; // 1 - number characters // 2 - character itself string s6 (15,'*'); cout << "s6 is: " << s6 << endl; // 1 - start iterator // 2 - end iterator string s7 (s3.begin(),s3.end()-5); cout << "s7 is: " << s7 << endl; // you can instantiate string with assignment string s8 = "Anatoliy"; cout << "s8 is: " << s8 << endl; return 0; } OUTPUT: // s1 is: Anatoliy // s2 is: Anatoliy // s3 is: short line for testing // s4 is: short line // s5 is: line // s6 is: *************** // s7 is: short line for te // s8 is: Anatoliy getline 1.
/* 1 getline ( intut_stream, str, delim ); Extracts characters from intut_stream and stores them in str until s.max_size() characters have been extracted, the end of file occurs, or delim is encountered, in which case delim is extracted from istr but is not stored in s 2 getline( Iter, str ) Inputs a string value for str as in the preceding func tion with delim = */#include#include #include #include using namespace std; int main () { string str; cout << "Enter string (EOL = $) : "; getline (cin, str, '$'); cout << "Str is : " << str << endl; ifstream In("data.dat"); vector v; cout << endl << "Read data from file" << endl; while ( ! In.eof() ) { getline (In, str); v.push_back(str); } copy (v.begin(),v.end(), ostream_iterator (cout,"\n")); cout << endl; return 0; } OUTPUT: // Enter string (EOL = $) : Str is : first line // second line$ // // Read data from file // file: "data.dat" // second line // last line << >> operators 1.
#include#include using namespace std; int main () { string str; cout << "Enter string for testing : "; cin >> str; cout << "\nString is : " << str << endl; cout << "Enter string for testing " << "( d to quit) : "; while ( cin >> str ) { cout << endl; cout << "String is : " << str << endl; cout << "Enter string for testing " << "( d to quit) : "; } return 0; } OUTPUT: // Enter string for testing : first // String is : first // Enter string for testing ( d to quit) : second // String is : second // Enter string for testing ( + += = operators 1.d to quit) : third // String is : third // Enter string for testing ( d to quit) :
#include#include using namespace std; int main () { string str = "Hello"; cout << "str is : " << str << endl; str += ","; str += ' '; cout << "str is : " << str << endl; string s; s = str + "World"; cout << "s is : " << s << endl; char ch = '!'; s += ch; cout << "s is : " << s << endl; return 0; } OUTPUT: // str is : Hello // str is : Hello, // s is : Hello, World // s is : Hello, World! append 1.
#include#include using namespace std; int main () { string str = "Nobody is perfect"; string s = ""; // empty string char *ch = "abcdef"; // append string str at the end of s; // return s // appends at the end of s a copy of the n characters // in str, starting at position pos; if n is too // large, characters are copied only until the end // of str is reached; // returns s s.append(str,0,6); cout << "s is : " << s << endl; // appends copies of the characters in the range [inpIt1, // inpIt2] to s; returns s string::iterator inpIt1 = str.begin()+6; //start from ' is' string::iterator inpIt2 = str.end(); s.append(inpIt1,inpIt2); cout << "s is : " << s << endl; // appends three ! s.append(3,'!'); cout << "s is : " << s << endl; // appends the first n characters in ch at the end // of s; returns s s.append(ch,3); cout << "s is : " << s << endl; // appends charArray at the end of s; returns s s.append(ch,3); cout << "s is : " << s << endl; return 0; } OUTPUT: // s is : Nobody // s is : Nobody is perfect // s is : Nobody is perfect!!! // s is : Nobody is perfect!!!abc // s is : Nobody is perfect!!!abcabc assign 1.
#include#include using namespace std; int main () { string str = "Nobody is perfect"; string s = ""; char *ch = "Robert Frost"; // assigns a copy of str to s; returns s s.assign(str); cout << "s is : " << s << endl; // assigns to s a copy of the n characters in str, start // ing at position 10: if n is too large, characters are // copied only until the end of str is reached: returns s s.assign(str,10,7); // perfect cout << "s is : " << s << endl; // assigns to s a string consisting of the first n charac // ters in ch: returns s s.assign(ch,6); cout << "s is : " << s << endl; // assigns to s a copy of ch: returns s s.assign(ch); cout << "s is : " << s << endl; // assigns to s a string consisting of the characters in // the range str.begin(), str.end(); returns s s.assign(str.begin(),str.end()); cout << "s is : " << s << endl; // assigns to s a string consisting of n copies of ch; // returns s s.assign(17,'*'); cout << "s is : " << s << endl; return 0; } OUTPUT: // s is : Nobody is perfect // s is : perfect // s is : Robert // s is : Robert Frost // s is : Nobody is perfect // s is : ***************** at 1.
// returns s[pos]#include#include using namespace std; int main () { string s = "Nobody is perfect"; // Returns s[pos] for ( int pos = 0; pos < s.length(); ++pos ) cout << s.at(pos) << " "; cout << endl; return 0; } OUTPUT: // N o b o d y i s p e r f e c t begin 1.
// Returns an iterator positioned at the // first character in a string#include#include using namespace std; int main () { string str = "C++ is best computer language"; string::iterator It = str.begin(); while ( It != str.end() ) { if ( *It == ' ' ) *It = '\n'; cout << *It++; } cout << endl; return 0; } OUTPUT: // C++ // is // best // computer // language c_str 1.
// returns (the base address of) a char // array containing the characters stored in s, // terminated by a null character.#include#include using namespace std; int main () { string str = "Anatoliy"; char *ary = new char[str.length()+1]; // strcpy ( ary, str ); that is wrong way strcpy ( ary, str.c_str() ); // that is correct cout << ary << endl; return 0; } OUTPUT: // Anatoliy capacity 1.
// returns the size (of type size_type) // of the storage allocated in string#include#include using namespace std; int main () { string str = "C++ is best computer language"; string::size_type cap; cap = str.capacity(); cout << "Capacity of str is: " << cap << endl; cout << "Size of str is : " << str.size() << endl; cout << "Length of str is : " << str.length() << endl; cout << "Resize the str for 50 character" << endl; str.resize(50); cap = str.capacity(); cout << "Capacity of str is: " << cap << endl; cout << "Size of str is : " << str.size() << endl; cout << "Length of str is : " << str.length() << endl; return 0; } OUTPUT: // Capacity of str is: 32 // Size of str is : 29 // Length of str is : 29 // Resize the str for 50 character // Capacity of str is: 64 // Size of str is : 50 // Length of str is : 50 compare 1.
#include#include using namespace std; int main () { string str1 = "string"; string str2 = "String"; string str3 = "second string"; char ch[] = "first string"; cout << "string str1 is : " << str1 << endl; cout << "string str2 is : " << str2 << endl; cout << "char ary ch is : " << ch << endl; cout << "string str3 is : " << str3 << endl; cout << endl; // compare str1 and str2 cout << "1." << endl; size_t comp = str1.compare(str2); cout << "String str1 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to string str2" << endl; // compare str1 and literal string "string" cout << "2." << endl; comp = str1.compare("string"); cout << "String str1 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to array of char \"string\"" << endl; // 3. and 4. doesn't work with Microsoft // Visual Studio compiler // compare str3 start from pos 7 to 5 // with str1 cout << "3." << endl; comp = str3.compare(str1,7,5); cout << "Part of string str3 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to str1" << endl; // compare str3 start from pos 7 // with literal string "string" cout << "4." << endl; comp = str3.compare("string",7); cout << "Part of string str3 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to C string \"string\"" << endl; // next 4 'compare' functions // doesn't work with GNU compiler cout << "5." << endl; comp = str1.compare(6,10,ch); cout << "String str1 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to part of char ary \"first string\"" << endl; cout << "6." << endl; comp = str1.compare(0,3,str3); cout << "Part of str1 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to string \"second string\"" << endl; cout << "7." << endl; comp = str1.compare(1,3,str2,1,3); cout << "String str1 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to part of string \"second string\"" << endl; cout << "8." << endl; comp = str1.compare(1,3,str2,1,3); cout << "String str1 is "; ( comp == 0 ) ? cout << "equal" : cout << "not equal"; cout << " to part of string \"second string\"" << endl; return 0; } OUTPUT: GNU compiler // string str1 is : string // string str2 is : String // char ary ch is : first string // string str3 is : second string // // 1. // String str1 is not equal to string str2 // 2. // String str1 is equal to array of char "string" // 3. // Part of string str3 is equal to str1 // 4. // Part of string str3 is equal to C string "string" // 5. // 6. // 7. // 8. OUTPUT: Microsoft Visual Studio compiler // string str1 is : string // string str2 is : String // char ary ch is : first string // string str3 is : second string // // 1. // String str1 is not equal to string str2 // 2. // String str1 is equal to array of char "string" // 3. // 4. // 5. // String str1 is not equal to part of char ary "first // string" // 6. // Part of str1 is not equal to string "second string" // 7. // String str1 is equal to part of string "second string" // 8. // String str1 is equal to part of string "second string" // Press any key to continue copy 1.
#include#include using namespace std; int main () { string str = "First Name: Robert"; char fname[255]; cout << "str is: " << str << endl; int n = str.find(':'); str.copy(fname, // copy to array n+1, // how many char 0); // start position from str // must terminate fname with '\0'; fname[n+1] = 0; cout << "fname is: " << fname << endl; return 0; } OUTPUT: // str is: First Name: Robert // fname is: First Name: empty 1.
#include#include using namespace std; int main () { string str = "*******"; while ( ! str.empty() ) { cout << str << endl; str.erase(str.end()-1); } cout << endl; return 0; } OUTPUT: // ******* // ****** // ***** // **** // *** // ** // * end 1.
// returns an iterator porsitioned immediately // after the last character in string#include#include using namespace std; int main () { string s; string str = "*************************"; size_t pos = str.length(); while ( pos ) { s.assign ( str.begin(),str.end() - pos+1); cout << s << endl; pos -= 5; } return 0; } OUTPUT: // * // ****** // *********** // **************** // ********************* erase 1.
#include#include #include using namespace std; int main () { string str, s; for ( char ch = 'a'; ch <= 'z'; ch++ ) str.append(1,ch); s = str; cout << "str is: " << str << endl; cout << "s is: " << str << endl; // removes 13 characters from the beginning str.erase(0,13); cout << "Erased range fron str : " << str << endl; // removes 13 characters starts from 14 str = s.erase(13,13); cout << "Erased range from s : " << str << endl; // removes one character pointed by s.begin() cout << endl << "Erase one, second character from s" << endl; s.erase(s.begin()+1); cout << "s is: " << s << endl; // removes range of characters s.erase(s.begin(),s.begin()+4); cout << "s is: " << s << endl; return 0; } OUTPUT: // str is: abcdefghijklmnopqrstuvwxyz // s is: abcdefghijklmnopqrstuvwxyz // Erased range fron str : nopqrstuvwxyz // Erased range from s : abcdefghijklm // // Erase one, second character from s // s is: acdefghijklm // s is: fghijklm find 1.
#include#include #include using namespace std; int main () { string str("C++ is best language"); int pos1, pos2; // size_t or size_type // work not correct // search for first string "best" inside of str // default position is 0 pos1 = str.find ("best"); cout << "Word best is found on position " << pos1+1 << endl; // if pattern is not found - return -1 pos2 = str.find ("best",pos1+1); cout << "Word best is found on position " << pos2+1 << endl; // search for first occurrence of character pos1 = str.find('g'); cout << "First character 'g' found on position " << pos1 << endl; // search for first occurrence of string string s = "is"; pos1 = str.find (s); cout << "Word 'is' is found on position " << pos1+1 << endl; return 0; } OUTPUT: // Word best is found on position 8 // Word best is found on position 0 // First character 'g' found on position 15 // Word 'is' is found on position 5 find_first_not_of 1.
#include#include using namespace std; int main () { string str("C++ is best language"); cout << "str is: " << str << endl; int n = str.find_first_not_of("aeiouAEIOU"); cout << "First consonant found at " << n+1 << " position" << endl; return 0; } OUTPUT: // str is: C++ is best language // First consonant found at 1 position find_first_not_of 2.
#include#include using namespace std; int main () { string str("C++ is best language"); cout << "str is: " << str << endl; // search first not ' ', // start from position 7 int n = str.find_first_not_of(' ',7); cout << "first not of space character " << "found at position " << n+1 << endl; return 0; } OUTPUT: // str is: C++ is best language // first not of space character found at position 8 find_first_not_of 3.
#include#include using namespace std; int main () { string str("C++ is best language"); string s = "C++"; cout << "str is: " << str << endl; // search character from pattern // using the first x chåracters in pattern. // the value position must be given int n = str.find_first_not_of("CBCD",0,3); cout << "first not 'C' is found at position " << n+1 << endl; // search first not of // pattern is string n = str.find_first_not_of(s); cout << "first not of C++ is found " << "at position " << n+1 << endl; return 0; } OUTPUT: // str is: C++ is best language // first not 'C' is found at position 2 // first not of C++ is found at position 4 find_first_of 1.
#include#include using namespace std; int main () { string str("C++ is best language"); string s = "be"; cout << "str is: " << str << endl; // search be start from position 2 // if position is ommited - default is 0 int n = str.find_first_of(s,2); cout << "first 'be' found at position " << n+1 << endl; // same as above but search for character n = str.find_first_of('l'); cout << "first character 'l' found at " << "position " << n+1 << endl; // search 'first of' for the characters in // charary char charary[] = " bea"; cout << "charary[] = \" bea\"" << endl; n = str.find_first_of(charary,0); cout << "first character from charary " << "found at position " << n+1 << endl; cout << "Note: position 4 is space" << endl; // same as above but third argumen is // number of character from which searching // starts // this variant of find_first_of dosn't // work properly with GNU compiler n = str.find_first_of(" bae",0,3); cout << "first character from charary " << "found at position " << n+1 << endl; return 0; } OUTPUT: // str is: C++ is best language // first 'be' found at position 8 // first character 'l' found at position 13 // charary[] = " bea" // first character from charary found at position 4 // Note: position 4 is space // first character from charary found at position 4 find_last_not_of 1.
#include#include using namespace std; int main () { string str("C++ is best language"); string s = "langue"; int pos = str.length()-1; cout << "str is: " << str << endl; // returns the highest position <= pos of a character // in str that does not match any charcter in s; // returns nopos if there is no such position: // npos is the default value for pos int n = str.find_last_not_of(s, pos); cout << "last_not_of 'langue' found at position " << n+1 << endl; // same as above but search for single character n = str.find_last_not_of('e'); cout << "last_not_of 'e' found at position " << n+1 << endl; char ary[] = "be"; // seawrch for occurence last_not_of // from pattern ary in str n = str.find_last_not_of(ary); cout << "last_not_of 'be' found at position " << n+1 << endl; return 0; } OUTPUT: // str is: C++ is best language // last_not_of 'langue' found at position 12 // last_not_of 'e' found at position 19 // last_not_of 'be' found at position 19 find_last_of 1.
#include#include using namespace std; int main () { string str("C++ is best language"); string s = "g"; cout << "str is: " << str << endl; cout << "s is: " << s << endl; int n = str.find_last_of(s); cout << "last_of '" << s << "' faund" << " at position " << n+1 << endl; n = str.find_last_of(' '); cout << "last_of ' ' faund" << " at position " << n+1 << endl; n = str.find_last_of(" la"); cout << "last_of \" la\" faund" << " at position " << n+1 << endl; return 0; } OUTPUT: // str is: C++ is best language // s is: g // last_of 'g' faund at position 19 // last_of ' ' faund at position 12 // last_of " la" faund at position 18 insert 1.
#include#include using namespace std; int main () { string str = "C++ language"; string s = "is best"; char ch[] = "C++ language"; cout << "str is: " << str << endl; cout << "s is: " << s << endl; cout << "ch is: " << s << endl; // insert a copy of s into str // at position pos; string::size_type pos = 4; str.insert(pos,s); cout << "str is: " << str << endl; // insert a copy of ch into str at // the position specified by iterator // return an iterator positioned at // this copy int n = str.find('l'); str.insert(str.begin() + n,' '); cout << "str is: " << str << endl; // like above but n x copies of char str.insert(str.end(),3,'!'); cout << "str is: " << str << endl; // insert 4 char from ch into s // at the position 0 s.insert(0,ch,4); cout << "s is: " << s << endl; // insert 8 characters from str // start from position n ('langu...') // into s at position x (end string) n = str.find('l'); int x = s.length(); s.insert(x,str,n,8); cout << "s is: " << s << endl; n = s.find('l'); s.insert(s.begin()+n,' '); cout << "s is: " << s << endl; // insert range (begin - begin+7) of str // into s at position begin+4 s.insert(s.begin()+4,str.begin(),str.begin()+7); cout << "s is: " << s << endl; return 0; } OUTPUT: // str is: C++ language // s is: is best // ch is: is best // str is: C++ is bestlanguage // str is: C++ is best language // str is: C++ is best language!!! // s is: C++ is best // s is: C++ is bestlanguage // s is: C++ is best language // s is: C++ C++ is is best language length 1.
#include#include using namespace std; int main () { string str = "C++ is best computer language"; cout << "str is: " << str << endl; cout << "Length of str is : " << str.length() << endl; return 0; } OUTPUT: // str is: C++ is best computer language // Length of str is : 29 max_size 1.
// returns a reverse iterator positioned // at the last character in string#include#include using namespace std; int main () { string str = "C++ is best computer language"; cout << "str is: " << str << endl; cout << "max_size of str is: " << str.max_size() << endl; return 0; } OUTPUT: // str is: C++ is best computer language // max_size of str is: 4294967294 rbegin 1.
#include#include using namespace std; int main () { string str = "C++ is best computer language"; cout << "str is: " << str << endl; // usual iterator doesn't work string::reverse_iterator It = str.rbegin(); while ( It != str.rend() ) cout << *It++; cout << endl; return 0; } OUTPUT: // str is: C++ is best computer language // egaugnal retupmoc tseb si ++C replace 1.
#include#include using namespace std; int main () { string str = "STL is created from Dennis Ritchie"; string s1 = "was"; string s2 = "developed"; string s3 = "Stepanov alexander"; cout << "str is: " << str << endl; cout << "replace 'is' for 'was'" << endl; str.replace(4, // start position in str 2, // how many characters s1); // source for replasment cout << "str is: " << str << endl; cout <<"replace 'created' for 'developed'" << endl; int n = str.find('c'); // pos of 'created' int x = str.find("from") -1; str.replace(str.begin()+n,// start pointer str.begin()+x, // end pointer s2); // source cout << "str is: " << str << endl; cout << "replace 'Dennis' for 'alexander'" << endl; int x1 = str.find('D'); // search Dennis int x2 = str.find(' ',x1+1); // space after int y1 = s3.find("alex"); // search 'alex' int y2 = strlen("alexander"); str.replace(x1, // start position in str x2-x1, // how characters to replace s3, // source for replacement y1, // start positio from source y2); // how chracter start from y1 cout << "str is: " << str << endl; cout << "replace 'from' for 'by'" << endl; char ary[] = "bytes"; n = str.find("from"); // same variant possible with iterators // instead of number of position str.replace(n, // start position in str 4, // how many characters ary, // source 2); // first 2 characters from source cout << "str is: " << str << endl; cout << "replace 'a' for 'A' (alexander)" << endl; n = str.find("alexander"); str.replace(n, // start position in str 1, // how character(s) 1, // how many copies of character 'A'); // character for replasment cout << "str is: " << str << endl; cout << "replace 'Ritchie' for 'Stepanov'" << endl; x1 = str.find('R'); y1 = s3.find(' '); str.replace(str.begin()+x1, // start pointer str.end(), // to the end of str s3.begin(), // start pointer from source s3.begin()+y1 // end pointer from ); // source cout << "str is: " << str << endl; return 0; } OUTPUT: // str is: STL is created from Dennis Ritchie // replace 'is' for 'was' // str is: STL was created from Dennis Ritchie // replace 'created' for 'developed' // str is: STL was developed from Dennis Ritchie // replace 'Dennis' for 'alexander' // str is: STL was developed from alexander Ritchie // replace 'from' for 'by' // str is: STL was developed by alexander Ritchie // replace 'a' for 'A' (alexander) // str is: STL was developed by Alexander Ritchie // replace 'Ritchie' for 'Stepanov' // str is: STL was developed by Alexander Stepanov reverse 1.
#include#include using namespace std; int main () { string str = "Anatoliy Urbanskiy"; cout << str.reverse() << endl; return 0; } OUTPUT: resize 1.
// if <=s.size(), truncates rightmost // character in s to make it of size n; otherwise, adds // copies of character ch to end of s to increase it size // to n, or adds a default character value (usually a // blank) if ch is omitted; return type is void#include#include using namespace std; int main () { string str = "Alexander Stepanov"; cout << "str is: " << str << endl; cout << "size of str is: " << str.size() << endl; str.resize(11); cout << "after str.resize(11)" << endl; cout << "str is: " << str << endl; cout << "size of str is: " << str.size() << endl; str.resize(20,'.'); cout << "after str.resize(20,'.')" << endl; cout << "str is: " << str << endl; cout << "size of str is: " << str.size() << endl; return 0; } OUTPUT: // str is: Alexander Stepanov // size of str is: 18 // after str.resize(11) // str is: Alexander S // size of str is: 11 // after str.resize(9,'.') // str is: Alexander S......... // size of str is: 20 rfind 1.
#include#include using namespace std; int main () { string str = "We go step by step to the target"; string s1 = "step"; cout << "str is: " << str << endl; cout << "s1 is: " << s1 << endl; cout << "int n1 = str.find(s1)" << endl; int n1 = str.find(s1); cout << "n1 = " << n1+1 << endl; cout << "int n2 = str.rfind(s1)" << endl; int n2 = str.rfind(s1); cout << "n2 = " << n2+1 << endl; cout << "n3 = str.rfind(s1,n2-1)" << endl; int n3 = str.rfind(s1,n2-1); cout << "n3 = " << n3+1 << endl; cout << "n1 = str.rfind('t')" << endl; n1 = str.rfind('t'); cout << "n1 = " << n1+1 << endl; cout << "n2 = str.rfind('t',n1-1)" << endl; n2 = str.rfind('t',n1-1); cout << "n2 = " << n2+1 << endl; char ch[] = "step"; cout << "char ch[] = \"step\"" << endl; cout << "n1 = str.rfind(ch)" << endl; n1 = str.rfind(ch); cout << "n1 = " << n1+1 << endl; cout << "n2 = str.rfind(\"stabc\",10,2)" << endl; n2 = str.rfind("stabc", // pattern 10, // start position 2); // for first 2 char // in pattern cout << "n2 = " << n2+1 << endl; return 0; } OUTPUT: // str is: We go step by step to the target // s1 is: step // int n1 = str.find(s1) // n1 = 7 // int n2 = str.rfind(s1) // n2 = 15 // n3 = str.rfind(s1,n2-1) // n3 = 7 // n1 = str.rfind('t') // n1 = 32 // n2 = str.rfind('t',n1-1) // n2 = 27 // char ch[] = "step" // n1 = str.rfind(ch) // n1 = 15 // n2 = str.rfind("stabc",10,2) // n2 = 7 size 1.
#include#include using namespace std; int main () { string str = "We go step by step to the target"; string::size_type size = str.size(); cout << "str is: " << str << endl; cout << "size of str = " << size << endl; return 0; } OUTPUT: // str is: We go step by step to the target // size of str = 32 substr 1.
// str.subsr(pos,n); // returns a copy of the substring consisting // of n characters from str, beginning at position pos // (default value 0); if n is too large or is omitted, // characters are copied only until the end of s is // reached#include#include using namespace std; int main () { string str = "We go step by step to the target"; cout << "str is: " << str << endl; int n = str.find("step"); string s = str.substr(n); cout << "s is: " << s << endl; s = str.substr(n,12); cout << "s is: " << s << endl; return 0; } OUTPUT: // str is: We go step by step to the target // s is: step by step to the target // s is: step by step swap 1.
#include#include using namespace std; int main () { string str1 = "Robert"; string str2 = "Forest"; cout << "str1 is: " << str1 << endl; cout << "str2 is: " << str2 << endl; cout << endl; cout << "str1.swap(str2)" << endl; cout << endl; str1.swap(str2); cout << "str1 is: " << str1 << endl; cout << "str2 is: " << str2 << endl; return 0; } OUTPUT: // str1 is: Robert // str2 is: Forest // // str1.swap(str2) // // str1 is: Forest // str2 is: Robert
label:
cpp programming,
example,
string
Subscribe to:
Posts (Atom)
Labels
- _ASSERTE (1)
- _CRT_ASSERT (1)
- _CRT_ERROR (1)
- _CRT_WARN (1)
- _RPT0 (1)
- _RPT2 (1)
- _RPTF2 (1)
- -1073741515 (1)
- .vimrc (3)
- \160 (1)
- 00 (1)
- 0unzip (1)
- 10.4 (1)
- 1073741515 (1)
- 10minutemail (1)
- 28022013 (1)
- 5giay (1)
- ABI (1)
- absolute (1)
- Airlines (1)
- alias (2)
- Apple (3)
- Arch Linux (1)
- arduino (1)
- assignment (2)
- Australia (1)
- auto (1)
- Avoid (1)
- AvoidDirectlyAccessGlobals (1)
- AXE central processors (1)
- AXE system (1)
- bash (6)
- Bash script (3)
- bashrc (2)
- BIG_ENDIAN (1)
- bit-fields (1)
- blogspot (1)
- break down (1)
- buffer overflows (1)
- bug tracking (1)
- build (1)
- Built-in Shell Variables (1)
- C library (1)
- C programming (1)
- c shell (2)
- C++ (1)
- C++ Programming (1)
- C++Test (2)
- case (1)
- cast (1)
- cc (1)
- CDRWIN (1)
- CFLAGS (1)
- change management (1)
- check (1)
- check float values equality (1)
- checker (1)
- CHECKSUM (1)
- chrome (1)
- cl.exe (1)
- clearcase (1)
- Clearcase commands (1)
- cleartool (2)
- Clock (1)
- CloneCD (1)
- cloud (2)
- cmd (1)
- co.cc (1)
- CodePlex (1)
- Coding (1)
- Coding standard (1)
- Coding Standards (1)
- color (1)
- colour (1)
- Command Line (1)
- Command-Line (1)
- Command-Line editing (1)
- Command-Line editing mode (1)
- CommandLine (1)
- compilation (1)
- compile (1)
- compiler (2)
- compliance (1)
- compliance checker (1)
- constructor (1)
- Copy (2)
- cpp programming (1)
- CreateFile (2)
- creator (1)
- critical systems (2)
- cscope (3)
- csh (1)
- ctags (1)
- customer service (1)
- CXXFLAGS (1)
- dangerous functions (1)
- DCB sructure (1)
- Debian (1)
- debug (2)
- DEK Technologies (1)
- Delete (1)
- detected (1)
- Dev-cpp (1)
- developers (1)
- device (1)
- device driver (1)
- DeviceIoControl (1)
- diagram (1)
- diff (1)
- Directly (1)
- disposable (1)
- disposable e-mail addresses (1)
- divide and conquer. (1)
- dns (2)
- domainname (1)
- downgrade (1)
- drawback (1)
- dropbox (1)
- e-mail addresses (1)
- eclipse (1)
- Edit (1)
- End (1)
- environment (1)
- epsilon (1)
- Ericsson (4)
- ERLANG (2)
- errno (1)
- Error (2)
- error code (1)
- error result (1)
- example (1)
- Excel (1)
- exec (1)
- execute (1)
- execution time (1)
- exit code (1)
- explicit calculation of pointer (1)
- explorer (1)
- facebook (3)
- fansipan (1)
- fb (1)
- Fedora (1)
- fgets (1)
- Firefox (1)
- Firefox shortcuts (1)
- float (1)
- float equality (1)
- floating point (1)
- folding (1)
- forwarding (1)
- free (1)
- FreeCommander (1)
- from cl (1)
- function (1)
- Functions (3)
- FunctionsCallOrder (1)
- gitdiff (1)
- global data (1)
- gmail (1)
- GNU (5)
- google (1)
- GreatNews (1)
- Ground (1)
- Guerrilla Mail (1)
- Guidelines (1)
- Headquarters (1)
- help desk ticketing (1)
- high-level (1)
- holiday (1)
- Home (1)
- host (1)
- hostname (2)
- hosts (2)
- howto (1)
- iCloud (1)
- ide (1)
- illegal (1)
- implementation code (1)
- indexing (1)
- inet_pton (1)
- interface header (1)
- ioctl() (1)
- iPhone (1)
- iPhoneVietnam (1)
- java (1)
- jetstar (1)
- Job Ad (1)
- Karaoke (1)
- Korn shell (1)
- labelname (1)
- layers (1)
- Legibility (1)
- less confusing (1)
- linux (2)
- LITTLE_ENDIAN (1)
- login (1)
- lsocket (1)
- Lunar new yeat (1)
- Mac (1)
- Mac OS (1)
- Mac OS shortcuts (1)
- mailinator (1)
- maintainability (2)
- make (2)
- make clean (2)
- Makefile (2)
- Mandriva (1)
- Melbourne (1)
- memory (2)
- Microsoft (1)
- Mint (1)
- mintemail (1)
- misra (3)
- MISRA-C (1)
- MISRA-C 2004 (1)
- misra2004 (1)
- Mobifone (1)
- MobileMe (1)
- Modular (1)
- Modular programming (1)
- modules (1)
- more readable (1)
- Multi-Targeting (1)
- nbtscan (1)
- nbtstat (1)
- nested (1)
- network (1)
- network operations (1)
- nm. objdump (1)
- NoMachine (1)
- notepad++ (1)
- OFFLOAD (1)
- open() (1)
- OpenNx (1)
- OpenSSH (1)
- OpenStack (1)
- openSUSE (2)
- Orcas (1)
- outlook (1)
- outlook 2007 (1)
- parasoft (7)
- parts (1)
- password (1)
- Paste (1)
- patterns (1)
- PCLinuxOS (1)
- PCmover (1)
- perl (2)
- pkgmgr (1)
- PLEX (2)
- PLEX-C (1)
- pointer (2)
- pointer alignment (1)
- Pointer arithmetic (1)
- pop (1)
- Precompile (1)
- print16() (1)
- print32() (1)
- printHex() (1)
- programming (4)
- Programming Language for EXchanges (1)
- prompt (1)
- protocol (1)
- Puppy Linux (1)
- push (1)
- putty (2)
- re-use (1)
- read() (1)
- readelf (1)
- ReadFile (1)
- real-time (1)
- regsvr32 (1)
- request tracker (1)
- Reset Windows password (1)
- risky (1)
- rule (1)
- Sabayon Gentoo Live CD (1)
- safe (1)
- safety code (1)
- SBG HW environment (1)
- Screen (1)
- script (2)
- secure (1)
- Security (1)
- Send To (1)
- Send To menu (1)
- SendTo (1)
- serial number (1)
- serial port (1)
- Serial programming (2)
- services (1)
- sethc.exe (1)
- setup (1)
- setview (2)
- shared mem (1)
- shell (3)
- shell:sendto (1)
- side effects (1)
- site feed (1)
- skew (1)
- Slackware (1)
- snprintf (1)
- socket (1)
- source (1)
- ssh (2)
- status (1)
- strace (1)
- stray (1)
- string (2)
- strncat (1)
- strncpy (1)
- struct (1)
- SunOS (1)
- SWAP16/32 (1)
- switch (1)
- symbol (2)
- system (1)
- system() cmd (1)
- Tab (1)
- taglist (1)
- TC shell (1)
- TCP (1)
- tcpdump (1)
- technique (1)
- Telnet Client (1)
- tenmien (1)
- test (1)
- Testing (1)
- Tet (1)
- Thread safe (1)
- Thread safe programming (1)
- thread safety (1)
- Thunderbird (2)
- Tiger (1)
- tip (1)
- Tips (1)
- trick (1)
- tutorial (1)
- typedef (1)
- Ubuntu (1)
- UCdetector (1)
- uninitialized (1)
- union (1)
- unix (3)
- Unix access (1)
- unsafe (2)
- unsafe string (1)
- unzip (1)
- update (1)
- upgrade (1)
- useful tools (2)
- Variable Substitution (1)
- variables (1)
- vav (3)
- vav.vn (2)
- version (1)
- vi (2)
- Vietnam airlines (1)
- Viettel (1)
- vim (4)
- vimdiff (1)
- viminfo (1)
- Vinaphone (1)
- Violation (2)
- Vista (2)
- visual studio (1)
- vnnic (1)
- void (1)
- vs2005 (1)
- vs2008 (1)
- vspc (1)
- warranty (1)
- web (1)
- website (2)
- website test (1)
- Win8 (1)
- Windows (2)
- Windows 8.1 (1)
- winsxs (1)
- winsxslite (1)
- WinXP (1)
- workflow processes (1)
- write() (1)
- WriteFile (1)
- X (1)
- x11 (1)
- x64 (1)
- Xming (1)
- youth counselling (1)
- youtube (1)
- zebrazone (1)
- zebrazoo (1)
- zim (1)