Yippeee, I finaaly got the search function working.
Took me long enough to realise I wasnt skipping the space character which was casuing all the trouble.
I would like to take this chance to...
Type: Posts; User: compnub1
Yippeee, I finaaly got the search function working.
Took me long enough to realise I wasnt skipping the space character which was casuing all the trouble.
I would like to take this chance to...
The strcmp is used to recoginze to word search as a command.
once it noticeds the command it then goes go on to the search pharse and compares it to the contents of the array.
Ok i correct my mistakes and it still doesnt work. The program does not reconginse the search command and simply ignores it. Also I can only have two command line arguements when i run the program....
str[][] is the array where i store the lines of data from a sample file.
Then i run the program like this ./program text1.txt
and then my function is supposed to search for words in the file.
...
Ok i put a null character at the back of char input2 and char input3. I then I used the a loop to get the position by using strlen and then going backwards until it hits the space. I then assign the...
OK I tried using a loop to spilt the strings up but when i type in search and a search phrase nothing happens. I dont understand why this is happening. Could someone plz tell me why because i have...
How do you peel of the first word and treat everything else as the remaining line.
Can some1 plz post an example on how to do it because im at a lost of how to do it. Also Im not sure if my strstr...
problem is the search term might be more then 1 search term like "search blah blah"
sscanf stops when there is a space.
:(
Hi there.
I have problems with my search function when i read in the command search and then also read in the word that needs to be searched. eg when i enter the command "search blah" it it...
MK27 yourr a geniussssss!!!!!!!!!! It works now.
Thanks for the tip :):)
However is it bad style to have many EXIT_SUCCESS in your program.
maybe make d an array like this
char d[100];
and to terminate string maybe use d*='/0'
pend a null character to end of string maybe.
im not sure about this though
Yea I noticed that and corrected it but it still doesnt solve why the first while loop isnt working.
eg. while(!EXIT_SUCCESS){
printf("Enter command > ");
This loop is supposed...
Hi everyone,
I am having trouble trying to keep printing the promt "Enter command >" .It only prints the promt once and then doesnt work. Can some1 tell me why cause i have spent ages...
i got to keep printing Enter command > when the user has not finish issuing commands and then the program ends itself through the command quit. So how do i do this and at the same time compare it to...
I have to keep the file open so that it can keep printing "Enter command >". Also i dont get what you mean by fgets hosing the strcmp. The print command only works once and the exit command doesnt...
Ok i got rid of the multiple fgets and it works but y does the command print not work after the first time??
Also when i enter the command quit the program wont close itself?/ why is that?
...
Maybe you can be the star in the middle like this for better style.
FILE * fp
Hi there,
I am having some problems prompting the user to enter a command in.
for example i want the command"print" to be recongised multiple time.
Its supposed to behave like this: Enter...
Oh i got it .
Damn it i am such a doushe.
:rolleyes:
My corrections
Hi there,
I was writing a program to read in a string and print it out in reverse. But for some reason it doesnt compile.The error said
In function ‘main’:
error; too few...
Thank to everyone who helped me :)
I finally got there in the end by using this.
thnx again guys.
if(price[i] > price[i+1]|| (price[i]==price[i+1] && year[i]>year[i+1])||...
So how would i phrase my if statement.
Can some1 plz write a example of wat to do as the work is due soon..
Why is every1 wasting time to respond to him!!
come help people with problems like me.
Does any1 have any ideas???
Cause I have been trying to fix this for 2 days with no success.
Ok I did what u said but now im getting an infinite loop.
any ideas why??
for(i=0; i < len-1 && retval == 0; i=i+1){
if(price[i] > price[i+1]){