The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 EOF

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ovince Posted - 10/28/2006 : 03:49:08 AM
hi


I would also like to simulate while loop with idea to read out data from fajl while not EndOfFile is encoutered. How to do it?


thanks
oliver
1   L A T E S T    R E P L I E S    (Newest First)
zachary_origin Posted - 10/28/2006 : 05:59:36 AM
Hi Oliver,


1. Use the funtions for file I/O.


void test_feof()
{
int count, total = 0;
char buffer[100];
FILE *stream;

// open your current using C file for read
stream = fopen( __FILE__, "r" );
if(stream == NULL )
printf( "The current C file was not opened\n" );

// Cycle until end of file reached:
while( !feof( stream ) )
{
// Attempt to read in 10 bytes:
count = fread( buffer, sizeof( char ), 100, stream );
if( ferror( stream ) )
printf("Read Error");

// Total up actual bytes read
total += count;
}

printf( "Number of bytes read = %d\n", total );
fclose( stream );
}



For more details, see Help: Programming: Origin C Language Reference: Global Functions: File I/O.

2. Use Worksheet::ImportASCII to import the data file into a worksheet. see Help: Programming: Origin C Language Reference: Classes: Internal Origin Objects: Worksheet::ImportASCII


Zachary
OriginLab Technical Services.

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000