Wednesday, February 24, 2010

Errors and Warning IN BIO TESTER

there have a error and some warnings in BIO TESTER when compiling.

1. there are too many actual parameters in bio_edit. For example, line 231 in BIO TESTER biomain.c is the "key = bio_edit(str,11,30, 20, 60,&insert, &offset, &curpos, 0, 0); ". The last "0" is unuseful.

2.In BIO TESTER biomain.c, mentions the "BIO_TAB_SIZE", but in wikipage(http://zenit.senecac.on.ca/wiki/index.php/BIOF_20101_%28AS1%29_-_OOP344), there are just mentions the "CIO_TAB_SIZE".

3. In line 707 of biomain.c, when compile it, there have a warning that 'del' is unreferenced local variable.

Wednesday, February 10, 2010

fflush in c language

fflush is a C function belonging to the ANSI C standard library, and included in the file stdio.h. Its purpose is deliver, to the host environment, unwritten data present in an output or update stream, or multiple streams, to be actually written to those streams' underlying file or device.

For its behavior to be well-defined on an update stream, the behavior of fflush is defined only if the most recent operation was not input.

The return value is an integer which means:

•0 (zero) : function performed successfully in the stream.
•EOF : an error occurred and errno is set.

Note that each error number has a distinct meaning. The meaning can usually be revealed by checking errno.h; the strerror() function converts an error number to a descriptive text string.

Remarks
•The fflush function is usually used to prevent data loss by ensuring that the data is written to stream
•It should be used for output streams only; otherwise the behavior is undefined.
•Often fflush is used on the standard output stream because stdout is usually buffered and the output might not be prompted immediately.
•A call to fclose will flush the stream.
•A null argument did not have defined behavior in older implementations of the C library.
•It is a common, though incorrect practice to use fflush on the input stream, in order to clear any extraneous input left behind by a scanf function. This may not work in all compilers, and should generally be avoided.

Friday, January 29, 2010

Optimizing the Code of Wen Fang Chen's Blog

Her code can not calculation for negative number. I fixed it.

void sep(int val){
int i;
if (val<0){
val=-val;
bio_putch(45);
}

if(val/10){
i=val%10;
sep(val/10);
}
else
i=val % 10;
bio_putch(i?i+48;48);
}

void bio_putch(int val){
sep(int val);
}

Wednesday, January 20, 2010

Some Useful SVN Commands

svn checkout/co
svn checkout or svn co. This command is used to pull an SVN tree such as svn://zenit.senecac.on.ca/oop344/trunk from the server. You should only need to do this once. If the directory structure is changed (as is sometimes necessary), you may occasionally need to delete your local sand box and re-check it out. If this is going to be needed, it will usually be because the Editor will have made a large change and it will be announced at least on the file list.

svn add
svn add. When you are creating a new file or directory, you need to tell the SVN server about it. This command does that. Note that the file won't appear in the repository until you do an svn commit (see below).

svn propset
svn propset. When you are creating a new file or directory, you generally need to tell the SVN to apply properties to the file in places that have keywords in a special format such as $Date: 2007-04-03 14:28:17 -0500 (Tue, 03 Apr 2007) $. Note that the keyword value won't appear in the file until you do an svn commit (see below).

svn delete
svn delete. This does what it says! When you do an svn commit the file will be deleted from your local sand box immediately as well as from the repository after committing.

svn status
svn status. This command prints the status of working directories and files. If you have made local changes, it'll show your locally modified items. If you use the --verbose switch, it will show revision information on every item. With the --show-updates (-u) switch, it will show any server out-of-date information.

You should always do a manual svn status --show-updates before trying to commit changes in order to check that everything is OK and ready to go.

svn update/up
svn update or svn up. This command syncs your local sand box with the server. If you have made local changes, it will try and merge any changes on the server with your changes on your machine.

svn commit/ci
svn commit or svn ci. This command recursively sends your changes to the SVN server. It will commit changed files, added files, and deleted files. Note that you can commit a change to an individual file or changes to files in a specific directory path by adding the name of the file/directory to the end of the command. The -m option should always be used to pass a log message to the command. Please don't use empty log messages (see later in this document the policy which governs the log messages).


svn move
svn move SRC DEST or svn mv SRC DEST or svn rename SRC DEST or svn ren SRC DEST. This command moves a file from one directory to another or renames a file. The file will be moved on your local sand box immediately as well as on the repository after committing.

Monday, January 11, 2010

this is my first Blog

hello everyone! welcome to my blog.