hey does anyone know a good way to count the number of words in a file...i posted one earlier but it doesnt work very well...
thanks
Type: Posts; User: ccoder01
hey does anyone know a good way to count the number of words in a file...i posted one earlier but it doesnt work very well...
thanks
hey does anyone know a good way to count the number of words in a file...i posted one earlier but it doesnt work very well...
thanks
no worries...i figured it out... code below
int fileLength(FILE *file) {
int file_len=0;
char line[LINESIZE];
char *linePtr = line;
hi everyone,
for some reason im getting a segfault when i run this code to count how many words there are in the file...also if theres a better way to do it ..please let me know thanks...
...
hi all,
i still couldnt fix the bug...so ive just tried to copy an example out of a textbook.. the code below simply puts the letter a in a list ...and then i attempt to print the list...when i...
hey everyone,
im just trying to add a new node to the end of this list and print the list out...can someone tell me what i am doing wrong..thanks alot
#include <stdio.h>
#include...
hi everyone...
could someone please tell me why im getting a seg fault here...its a very small example...and i would appreciate if someone could rewrite this without the fault...thanks..btw the...
hi everyone,
i finally got my code to search mulitple times against a string..
ie. the string is :
<title>hi all</title><dummy>sdf</dummy><title>hi everone</title>
and i search for...
this is how i loaded the file into a string...
fgets only takes 3 arguments...where can i specify what \n will be
char *fgets(char *s, int size, FILE *stream);
hi,
does anyone know a quick way to remove all \n from a file that has been loaded into memory...ie. i have a file loaded into a string ...and it has all \n in it!...thanks..
k... i fixed that...still doesnt work..any other suggestions?
thanks..
hi everyone,
im searching a string using regex and it works fine...but it only returns me the first result...im trying to store all the results(indicies) in an array, and return it..
thanks for...
thanks for all ur help ppl...i fixed all my memory problems :)
thats correct...each time i add something to the array...all i need is one int...
which is 1 element...isnt it?
ok...ive fixed the problem in setSearchTag...i needed to use calloc instead of malloc....
but i now get a bus error in the search method above...gdb tells me its on the line where i do my realloc...
i still couldnt find the problem...i steped through setSearchTag()...it does exactly what i want...but if...i print the variable file before and after the method call...it changes....which is really...
maybe u needed more detail to help me...
here is where i called it...and the variable that was stuffing up is file (passed into searchForTags()...
void searchForTags(char *file) {
...
this is C....???? compiled using gcc!...anyone know how to fix
hi,
there is a memory allocation problem in this method..because although it compiles and runs ok...it stuffs up one of my other variables...
can someone please help
thanks alot
also 1 more thing....why is it now...when i call setSeachTag() again....it gives me a bus error
on the malloc line?
currentSearch = setSearchTag("title", currentSearch);
currentSearch =...
cool ..thanks
hi,
i get a seg fault when i try to print the currentSearch ...and suggestions?
thanks
char *currentSearch = NULL;
is there any other way i can copy the contents of a file into a string..?
hi,
im just simply copying the whole contents of a file from the net into a string in my program and printing it out...this doesnt work,,any suggestions on how to fix or do it another way?
...
please look at the function printheadlines ... tempPtr is pointing to something...
tempPtr = arrayOfStories [i];
tempStory = *tempPtr;