Vart,
I tried again..but it doesnt give me any output... as in it shld give me "Data Found" rite when task = venor setup........ dunno whr exactly am goin wrong
Vart,
I tried again..but it doesnt give me any output... as in it shld give me "Data Found" rite when task = venor setup........ dunno whr exactly am goin wrong
shld i use fsprintf or fprintf ????? also cud u tel me the difference between the two !!!!
post your last codeOriginally Posted by nirmala.s
No, I couldn't - never heared about the first oneshld i use fsprintf or fprintf ????? also cud u tel me the difference between the two !!!!
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
my last code:
Code:# include <stdio.h> # include <stdlib.h> # include <string.h> int main() { FILE *in_file; char dataFile[20]; char date[20]; char operator[30]; char ts[80]; printf("Ënter file name"); scanf ("%s", dataFile); in_file = fopen(dataFile, "r"); fsprintf(in_file, "%s%s", date, operator); fgets(ts,sizeof(ts), in_file); if ( strstr(ts,"Vendor Setup") != NULL) { printf("Data found"); } return 0; }
1. you' still using in_file without check
2. you're using date and operator without initialization
3.you're not checking the result value of fgets
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
am sorry..i dunno how 2 go abt wht u say !!! can u help me ??? diz is my first in C...am just on the learnin curve !!! it mite sound silly but then, vent worked on C much, so findin it difficult as in am learnin one by one n tryin them out 2 get it goin !! Cud u help in lettin me knw wht changes i need 2 make ???
I dunno wut da ya min byzed
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler