<?xml version="1.0" encoding="utf-8"?>
<!-- generator="FeedCreator 1.7.2" -->
<rss version="2.0">
    <channel>
        <title>Lowyat.NET: Latest topics by blixn</title>
        <description></description>
        <link>http://forum.lowyat.net/</link>
        <lastBuildDate>Fri, 05 Jun 2026 12:09:12 +0800</lastBuildDate>
        <generator>FeedCreator 1.7.2</generator>
        <item>
            <title>can anybody check this for me....</title>
            <link>http://forum.lowyat.net/topic/433173</link>
            <description>#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int file_copy(char *oldname, char *newname, long bytes1, long bytes2);&lt;br /&gt;long get_bytes(float percent, char *source);&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;	char source[80], destination[80];&lt;br /&gt;	float percent1, percent2;&lt;br /&gt;			&lt;br /&gt;	/*Get the file names*/&lt;br /&gt;	puts(&amp;quot;Enter source file:&amp;quot;);&lt;br /&gt;	printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;	gets(source);&lt;br /&gt;	puts(&amp;quot;&amp;#092;nEnter destination file &amp;#092;(WARNING: If the file exists, it will be OVERWRITTEN&amp;#092;): &amp;quot;);	&lt;br /&gt;	printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;	gets(destination);&lt;br /&gt;	&lt;br /&gt;	/*Get the positions in percentage*/&lt;br /&gt;	puts(&amp;quot;&amp;#092;nEnter start percentage (recommended: 0): &amp;quot;);&lt;br /&gt;	printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;	scanf(&amp;quot;%f&amp;quot;, &amp;amp;percent1);&lt;br /&gt;	do&lt;br /&gt;	{&lt;br /&gt;		puts(&amp;quot;&amp;#092;nEnter end percentage:&amp;quot;);&lt;br /&gt;		printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;		scanf(&amp;quot;%f&amp;quot;, &amp;amp;percent2);&lt;br /&gt;	} while ( percent2 &amp;lt; percent1 );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	if ( file_copy( source, destination, get_bytes(percent1, source), get_bytes(percent2, source) ) == 1 )&lt;br /&gt;		puts(&amp;quot;&amp;#092;nCopy operation SUCCESSFUL&amp;quot;);&lt;br /&gt;	else&lt;br /&gt;		fprintf(stderr, &amp;quot;&amp;#092;nError during copy operation&amp;quot;);&lt;br /&gt;&lt;br /&gt;	fflush(stdin);&lt;br /&gt;	puts(&amp;quot;&amp;#092;nPress any key to exit . . . &amp;quot;);&lt;br /&gt;	getchar();&lt;br /&gt;	return(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*Function for actual copying of file, return 1 on success, 0 otherwise*/&lt;br /&gt;int file_copy( char *oldname, char *newname, long bytes1, long bytes2)&lt;br /&gt;/*bytes1 denotes the start position in bytes, bytes2 denotes the end position*/&lt;br /&gt;{&lt;br /&gt;	FILE *fold, *fnew;&lt;br /&gt;	int c;&lt;br /&gt;&lt;br /&gt;	if ( ( fold = fopen( oldname, &amp;quot;rb&amp;quot; ) ) == NULL )&lt;br /&gt;		return 0;&lt;br /&gt;&lt;br /&gt;	if ( ( fnew = fopen( newname, &amp;quot;wb&amp;quot; ) ) == NULL  )&lt;br /&gt;	{&lt;br /&gt;		fclose ( fold );&lt;br /&gt;		return 0;&lt;br /&gt;	}&lt;br /&gt;		&lt;br /&gt;	/*Set file pointer to proper start location, as specified by user*/&lt;br /&gt;	if ( ( fseek(fold, bytes1, SEEK_SET) &amp;#33;= 0 ) )&lt;br /&gt;	{&lt;br /&gt;		fprintf(stderr, &amp;quot;&amp;#092;nError using fseek().&amp;quot;);&lt;br /&gt;		exit(1);&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	while (1)&lt;br /&gt;	{&lt;br /&gt;		c=fgetc(fold);&lt;br /&gt;&lt;br /&gt;		/*Continue copying until end of file or until the requested limit has been reached*/&lt;br /&gt;		if ( &amp;#33;feof( fold ) &amp;amp;&amp;amp; ftell(fold) &amp;lt;= bytes2)&lt;br /&gt;			fputc( c, fnew );&lt;br /&gt;		else&lt;br /&gt;			break;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	fclose ( fnew );&lt;br /&gt;	fclose ( fold );&lt;br /&gt;&lt;br /&gt;	return 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*This function finds how many bytes need to copied, calculating it from the percentage inputted by the user*/&lt;br /&gt;long get_bytes(float percent, char *source)&lt;br /&gt;{&lt;br /&gt;	long bytes;&lt;br /&gt;	FILE *fold;&lt;br /&gt;&lt;br /&gt;	if (percent&amp;lt;=100)&lt;br /&gt;	{&lt;br /&gt;		if ( ( fold = fopen( source, &amp;quot;rb&amp;quot; ) ) == NULL )&lt;br /&gt;		{&lt;br /&gt;			puts(&amp;quot;Error opening source file&amp;quot;);&lt;br /&gt;			exit(1);&lt;br /&gt;		}&lt;br /&gt;		if ( (fseek(fold, 0, SEEK_END))&amp;#33;=0)&lt;br /&gt;		{&lt;br /&gt;			fprintf(stderr, &amp;quot;&amp;#092;nError using fseek().&amp;quot;);&lt;br /&gt;			exit(1);&lt;br /&gt;		}&lt;br /&gt;&lt;br /&gt;		bytes=ftell(fold);&lt;br /&gt;		bytes*=(percent/100);&lt;br /&gt;	}&lt;br /&gt;	else &lt;br /&gt;	{&lt;br /&gt;		fprintf(stderr, &amp;quot;Error in input&amp;quot;);&lt;br /&gt;		exit(1);&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	fclose(fold);&lt;br /&gt;	return bytes;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;__________________________________________________________________&lt;br /&gt;&lt;br /&gt;i can run this but the i dont know wut to put in the &amp;quot;enter source code&amp;quot; and &amp;quot;enter destination part&amp;quot; ...stil need to submit this real soon...aaa..pliss help   &lt;!--emo&amp;:stars:--&gt;&lt;img src='http://static.lowyat.net/style_emoticons/default/rclxub.gif' border='0' style='vertical-align:middle' alt='rclxub.gif' /&gt;&lt;!--endemo--&gt;</description>
            <author>blixn</author>
            <category>Codemasters</category>
            <pubDate>Tue, 27 Mar 2007 22:12:26 +0800</pubDate>
        </item>
        <item>
            <title>can anybody check this for me?</title>
            <link>http://forum.lowyat.net/topic/433172</link>
            <description>#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;&lt;br /&gt;int file_copy(char *oldname, char *newname, long bytes1, long bytes2);&lt;br /&gt;long get_bytes(float percent, char *source);&lt;br /&gt;main()&lt;br /&gt;{&lt;br /&gt;	char source[80], destination[80];&lt;br /&gt;	float percent1, percent2;&lt;br /&gt;			&lt;br /&gt;	/*Get the file names*/&lt;br /&gt;	puts(&amp;quot;Enter source file:&amp;quot;);&lt;br /&gt;	printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;	gets(source);&lt;br /&gt;	puts(&amp;quot;&amp;#092;nEnter destination file &amp;#092;(WARNING: If the file exists, it will be OVERWRITTEN&amp;#092;): &amp;quot;);	&lt;br /&gt;	printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;	gets(destination);&lt;br /&gt;	&lt;br /&gt;	/*Get the positions in percentage*/&lt;br /&gt;	puts(&amp;quot;&amp;#092;nEnter start percentage (recommended: 0): &amp;quot;);&lt;br /&gt;	printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;	scanf(&amp;quot;%f&amp;quot;, &amp;amp;percent1);&lt;br /&gt;	do&lt;br /&gt;	{&lt;br /&gt;		puts(&amp;quot;&amp;#092;nEnter end percentage:&amp;quot;);&lt;br /&gt;		printf(&amp;quot;&amp;#092;t&amp;quot;);&lt;br /&gt;		scanf(&amp;quot;%f&amp;quot;, &amp;amp;percent2);&lt;br /&gt;	} while ( percent2 &amp;lt; percent1 );&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;	if ( file_copy( source, destination, get_bytes(percent1, source), get_bytes(percent2, source) ) == 1 )&lt;br /&gt;		puts(&amp;quot;&amp;#092;nCopy operation SUCCESSFUL&amp;quot;);&lt;br /&gt;	else&lt;br /&gt;		fprintf(stderr, &amp;quot;&amp;#092;nError during copy operation&amp;quot;);&lt;br /&gt;&lt;br /&gt;	fflush(stdin);&lt;br /&gt;	puts(&amp;quot;&amp;#092;nPress any key to exit . . . &amp;quot;);&lt;br /&gt;	getchar();&lt;br /&gt;	return(0);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/*Function for actual copying of file, return 1 on success, 0 otherwise*/&lt;br /&gt;int file_copy( char *oldname, char *newname, long bytes1, long bytes2)&lt;br /&gt;/*bytes1 denotes the start position in bytes, bytes2 denotes the end position*/&lt;br /&gt;{&lt;br /&gt;	FILE *fold, *fnew;&lt;br /&gt;	int c;&lt;br /&gt;&lt;br /&gt;	if ( ( fold = fopen( oldname, &amp;quot;rb&amp;quot; ) ) == NULL )&lt;br /&gt;		return 0;&lt;br /&gt;&lt;br /&gt;	if ( ( fnew = fopen( newname, &amp;quot;wb&amp;quot; ) ) == NULL  )&lt;br /&gt;	{&lt;br /&gt;		fclose ( fold );&lt;br /&gt;		return 0;&lt;br /&gt;	}&lt;br /&gt;		&lt;br /&gt;	/*Set file pointer to proper start location, as specified by user*/&lt;br /&gt;	if ( ( fseek(fold, bytes1, SEEK_SET) &amp;#33;= 0 ) )&lt;br /&gt;	{&lt;br /&gt;		fprintf(stderr, &amp;quot;&amp;#092;nError using fseek().&amp;quot;);&lt;br /&gt;		exit(1);&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	while (1)&lt;br /&gt;	{&lt;br /&gt;		c=fgetc(fold);&lt;br /&gt;&lt;br /&gt;		/*Continue copying until end of file or until the requested limit has been reached*/&lt;br /&gt;		if ( &amp;#33;feof( fold ) &amp;amp;&amp;amp; ftell(fold) &amp;lt;= bytes2)&lt;br /&gt;			fputc( c, fnew );&lt;br /&gt;		else&lt;br /&gt;			break;&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	fclose ( fnew );&lt;br /&gt;	fclose ( fold );&lt;br /&gt;&lt;br /&gt;	return 1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*This function finds how many bytes need to copied, calculating it from the percentage inputted by the user*/&lt;br /&gt;long get_bytes(float percent, char *source)&lt;br /&gt;{&lt;br /&gt;	long bytes;&lt;br /&gt;	FILE *fold;&lt;br /&gt;&lt;br /&gt;	if (percent&amp;lt;=100)&lt;br /&gt;	{&lt;br /&gt;		if ( ( fold = fopen( source, &amp;quot;rb&amp;quot; ) ) == NULL )&lt;br /&gt;		{&lt;br /&gt;			puts(&amp;quot;Error opening source file&amp;quot;);&lt;br /&gt;			exit(1);&lt;br /&gt;		}&lt;br /&gt;		if ( (fseek(fold, 0, SEEK_END))&amp;#33;=0)&lt;br /&gt;		{&lt;br /&gt;			fprintf(stderr, &amp;quot;&amp;#092;nError using fseek().&amp;quot;);&lt;br /&gt;			exit(1);&lt;br /&gt;		}&lt;br /&gt;&lt;br /&gt;		bytes=ftell(fold);&lt;br /&gt;		bytes*=(percent/100);&lt;br /&gt;	}&lt;br /&gt;	else &lt;br /&gt;	{&lt;br /&gt;		fprintf(stderr, &amp;quot;Error in input&amp;quot;);&lt;br /&gt;		exit(1);&lt;br /&gt;	}&lt;br /&gt;&lt;br /&gt;	fclose(fold);&lt;br /&gt;	return bytes;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;__________________________________________________________________&lt;br /&gt;&lt;br /&gt;i can run this but i dont know wut to put in the &amp;quot;enter source file&amp;quot; and the  &amp;quot;destination file&amp;quot; part....help me...got problem wif this and need to submit soon...aaaaa &lt;!--emo&amp;:stars:--&gt;&lt;img src='http://static.lowyat.net/style_emoticons/default/rclxub.gif' border='0' style='vertical-align:middle' alt='rclxub.gif' /&gt;&lt;!--endemo--&gt;</description>
            <author>blixn</author>
            <category>Linux &amp;amp; Open Source Software</category>
            <pubDate>Tue, 27 Mar 2007 22:07:58 +0800</pubDate>
        </item>
        <item>
            <title>heed help...plsss</title>
            <link>http://forum.lowyat.net/topic/426265</link>
            <description>what does it mean by the linux process and CPU scheduling (in Linux 2.6) ?</description>
            <author>blixn</author>
            <category>Linux &amp;amp; Open Source Software</category>
            <pubDate>Tue, 13 Mar 2007 22:01:33 +0800</pubDate>
        </item>
    </channel>
</rss>
