int main(int argc, char *argv[])
you can use the single star as previously stated all this is doing is point to an unbound array that stores command line inputs, I've always used the single star...
Type: Posts; User: @licomb
int main(int argc, char *argv[])
you can use the single star as previously stated all this is doing is point to an unbound array that stores command line inputs, I've always used the single star...
You really should try and acoid using feof, its not a very stable way of reading in lines of text even though it appears it does.
Ok i managed to get the program to work but it required me to take out the !feof, after a bit of digging i found out that this functions wasn't all that reliable so I did the following, hope this...
I tried that it still does the same thing
I ment to say
while ( (!feof(fn1)) || (!feof(fn2)) ),
but i have also tried this (!feof(fn1) && !feof(fn2)), it still doesn't work, and i can't seem...
Hi me again i hope someone can help, as you may not know my program reads in lines of text from 2 text files, it compares them and if they are different they write these lines to the third file
...
Ok after testing checking my program seems to work fine, it reads in the command line ok, it checks all the files, it reads in the lines from both files and compares them for a difference, were if...
Ok my program works, only problem is i am unsure of the stat command
say from the linux terminal
stat -l txtfile
it would display lots of info about that file, such as its permissions ...
I am writing my program that compares strings input from 2 txts files if they are different they write to the third. the program does all the compareing and writing to the third file with no problems...
Soz salem, got mixed up, i thought fgets was for getting information from a file, silly me.
Soz mate
-ali
Ok I have to write a program that uses the linux stat() function, it is supposed to read in a filename, were from were it will determine access permissions, it will end once the user enter a blank...
ok going off what people have said and offered. i have wrote the following.
No idea if it work,
Does anyone see a problem with it!!!
#include <stdio.h>
#include <string.h>
#include...
Don't forget to include the relevent library
#include <stdlib.h>
for the exit function to work!!
-ali
While you can use formating features such as /n /b and /t
You can also format how much space between screen imput etc.. is displayed, these are called field Width specifiers..
i.e
^ denotes a...
Wasn't cross posting i was told that this would be better place to ask a linux fucntion call, anyway there is somthing funny as it was i who posted this topic, somehow its attached itself to nick?
...
Me's silly for not telling you i use linux to compile and write code, i try to stay clear of VSC++ 6.
thanks for the code i will have a play
I am right in thinking that the struct stat is...
I don't know what happened nick for some reason it posted as your name ??? strange
Do i need to clear the buf1 and buf2 once its finished reading in a line, not sure realisticaly you should but i can't tell. be easy to cleat it just fill it with nulls in a for loop
Here's teh code with the errors fixed (I hope)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define MAX_LEN 80
int reperror, x;
FILE *fn1, *fn2, *fn3;
Yeah if the value is negative it will reflect this in were ever store the value.
I might not be understanding your question.
-ali
I would never of thought to use that :( thanks
Thanks for the help Zen, its greatly appricated, good to know there are some helpful people out there willing to help.
Do you think the program will do what is supposed to do.
-ali
so does this mean i would to change the while statement to
do
{
} (buf1 != EOF || buf2 != EOF )
Not sure if iam getting what you are saying :(
-ali
I fixed the while statement to || from |&
Thanks, fixed all those errors, oh i miss my compiler, looking at the program will it do what i looks like it will do.
Thanks, just noticed that myself, also i have changed the code so that it use fn1, fn2 and fn3 probalym was still using argv , which would no doubt cause an error.
Sorry, a while since i programed...
I've just noticed i haven't closed all the files,will add that to end of program.