Just before the break set the i to 10 (or greater).
Then the first for loop will stop.
Dylan
Type: Posts; User: dylan
Just before the break set the i to 10 (or greater).
Then the first for loop will stop.
Dylan
The code is compiled from the top down, then it gets to your jerk call in your main it does not yet know the function.
So you can move the function up top before main, or prototype the function...
See what happens when you print *j a second time right after the first. There is a good chance the first call to printf will use that memory space and the second printf will print "garbage".
So even...
Your fopen is appending to the file.
If you have a bad file you're just adding data to it.
Dylan
Wild guess, your open is failing and ofp is null.
You should exit out if its null.
Dylan
Also you should move
Before the open.
You asked how do to get the last argument from argv and you were told
argv[argc-1] that's a great answer.
You asked how you access all of argv[] and your were told to loop them, and that is also a...
Just put both in an outer for loop that loops 3 times.
Your main needs to be int main(.....
and you also need the return at the end.
Looks like you used one or the other each time.
Dylan
Then use scanf agian to grab the newline that is still in the input buffer right after your
scanf("%c",&ope);
Or change the scanf to get both at the same time.
*Note this will not work if...
It's just telling you you don't have the source file (bkwrds_str.c) in your current directory
"hello_world.c" is just the name of the source file you want to compile.
If you use the -o option you must tell gcc what name you want to give your compiled program not just the location.
gcc...
The strncmp only compares n chars, so your sample program would also match on
./program filename getting.
see strncmp
You can send me a private message if you want.
Dylan
Because it's wrong :)
if (strncmp(argv[2],"get",3) == 0 ) {
Dylan
Not sure what to tell you, it should work after you fixed the strncmp if statement.
Maybe post your new code with the fix.
Dylan
So you changed the if statement for the strncmp that NeonBlack pointed out?
And your printf prints :
before cmd = send
Dylan
In fileclient check your main arguments (and getCommandline).
In your getCommandline() make use of the argc and check how many arguments were passed to your program, so you don't try and access...
Something I did was re-write a small program that I already used. If you can pick one that is open source you can go back and see how someone else did it (don't just copy it, look after you have a...
The funny part of this is, it was your post that made me write that code/post.
You said one comment above mine :
So I wrote a 5 line program that WILL delete (ok if there was the code the...
Hmmm???
The code I posted was a joke, the first time I ran it it ran fine (Only because I used < 5 chars).
But my point was just because people's code runs it might not be correct, the second...
It's not?
So when I put "Dylan /home/dylan/keep_me" into name[6] and the "/home/dylan/keep_me" ends up outside of name[0]-name[5].
Is there another name for this then??
Dylan
What can go wrong
#include <stdio.h>
int
main(int argc, char *argv[])
{
char name[6];
char folder[] = "/home/dylan/old_folder";
printf("Enter your name : ");
You can not just drop an extra char in that char array.
You need to have a new array that will hold the extra chars and just loop through building the second one.
Something like this
for ( i =...
You only set a value to meter if lights is not (G,g,A,a) but you always check to see if its > 50.
If that's what you want just set it to 0 when you initialise it
int meter = 0;
The complier is...
Make sure cap starts as 0, also num_items.
And make sure your buf pointer points to NULL (or points to valid malloc'ed memory) or the realloc will try and work with memory it might *not* be able to....
Both inlet and meter are defined as char, but you scanf them as int's
scanf ("%i", &inlet);
Also you are going to have nelines in your input bufer after the scanf so you will need to get rid of...