Ok I've managed to make it work through sweat and tears and pure determination I've written a total of 27 if/if else's.
Now I still can't get the numbers and spaces to work, any ideas?
I updated the code FYI.
Ok I've managed to make it work through sweat and tears and pure determination I've written a total of 27 if/if else's.
Now I still can't get the numbers and spaces to work, any ideas?
I updated the code FYI.
For the numbers, setting output to 7 does not mean you will display '7', since 7 is <beep>.
the var simply tells it when to stop
it scans twice once to keep the loop going, the other for the program
ok so what do I do about the numbers? I tried to use fscan for variables for the digits 0-9 and got a segmentation fault
how do i scan single digits?
Last edited by 6kaine9; 10-19-2008 at 07:56 PM.
You may have deluded yourself into thinking so, but that's simply not true. Print out chrr and var before you start encrypting and see for yourself.
Edit: You had that right the first time. Now you've got the logic right, you just have to not use this var thing.
Last edited by tabstop; 10-19-2008 at 08:04 PM.
But I've already used the program for encrypting. It *IS* working its just that the spacebars and numbers don't work.
If you won't print out var, I will:
where oh where could your numbers have gone. (Note this is also where your spaces have gone.)Code:var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 0 var is: 102378
lmao ok you're right I just printed it too.
I bow down to your greatness.
So now what, toss it?
You need to do the same reading in the loop that you did outside, or used to:
Remember fscanf returns EOF on trying to read end of file. And also that read has to be inside the while loop, as inCode:var = fscanf("%c", &chrr);
And actually you don't really need var:Code:while ((var = fscanf("%c",&chrr)) != EOF)
Code:while (fscanf("%c", &chrr) != EOF)
ok i replaced that bit of code now it's telling me
encrypt10.c:27: warning: passing arg 1 of `fscanf' from incompatible pointer type
Oops, forgot the filename. You'll need f_in as the first parameter.
abcdef uvwxyz ZYXWVUTS RQPONML 102378
ok this bit is what it's supposed to read
I run it and input 0 as k, and it outputs:
It's stopping at the spacebar, why?abcde
lmao I had a break after the "else" bit of code.
Thanks so much man you don't believe how much of a help you were.
Now to decrypt the code....lmao