can any1 write a loop for me that will read the entire file
line by line.. i.e. on each iteration the line with newline charaacter must be stored in a string till the end of file... help..
can any1 write a loop for me that will read the entire file
line by line.. i.e. on each iteration the line with newline charaacter must be stored in a string till the end of file... help..
There's just 3 I/O functions you need to use here. fopen(), fclose(), and fgets(). Is your problem in understanding how to use these functions, or how to save the lines you read in with fgets()?
Originally Posted by bithub
i know these functions .... just i need a working loop...
ive written 1 but it goes into infinite loop
written 1 function GetLine(FILE *fp, char *str) .. pass the file pionter and store the line in a string str(gors infinte)..... i know the loop is not that big so kindly if u could wirte the whole loop for m plzplz...(im using Turbo C btw) help appreciated...
post your code, and I'll help you out.
i need to read a file format is ....
FILE FORMAT
SYMBOL MNEMONICS OPERANDS
..... ......... ........
[EOF]
symbols column may not contain a blank...
no. of blank sapces may not be 1
i need to read 1 line at a time so that ill have [symbol (1 blank) mnem0nics (1blank) operands] in my string...
examplefile to be read with smbol)
loop MOV B,FOUR
my string should conatain (loop MOV B,FOUR)
(without smbol)
DS F10
string should contain(DS F10) with info that there is no symbol...
well, best way to ready a line is using fgets fucntion. google fgets
HINT: fgets(char *, no of bytes to be read, FILE *);
ssharish2005
Again, post your code, and people will help you. We will not do your homework for you.
http://cboard.cprogramming.com/annou...ouncementid=51
thanx a lot guys.. but prblems solved
actually i had to write a prog to check the syntax of MOV and MVI instruction
so i had to read the source file that way but now i figured it out how to do it.
thanx a lot
i didnt ask ne1 to do my homework .... just needed to know how to read the file the way it was needed... neway thanx for the help...
can any1 write a loop for me that will read the entire file
line by linei know the loop is not that big so kindly if u could wirte the whole loop for m plzplz...i didnt ask ne1 to do my homework
i hate to beat a dead horse.. but i think it deserves it..