last day (22 days later) » 

21:41
Hey, Im using command line arguments for a program that takes a filename and reads from the location specified
If i open the program with the F5 button, and enter the name of a file that's there it works
But with command line arguments it doesnt work unless I enter the full file destinatoin
why?
With normal running it works with the name of the file

eg:"1.txt"
@MohamedAhmedNabil how are you providing the arguments?
@MohamedAhmedNabil can you show me the command you type?
Its a bit long but ill try
at first glance the code looks fine
21:45
"C:\Users\Mohamed\......\CWF 9.1.exe" 1.txt
this is the exact command
everytime i write 1.txt when i open it with CMD it says error
the program is called "CWF 9.1"?
yes
@MooingDuck I do write .exe btw. I forgot to write it here
@MohamedAhmedNabil I presume by "exact" you mean except for the "......" bit? :P
@MohamedAhmedNabil huh, looks fine to me
waaaaiiit
when you're in CMD, there's the bit you type at:
C:\Documents and Settings\Mohamed>
What does _that_ say?
21:48
I have to do this for it to work

"C:\Users\Mohamed\......\CWF 9.1.exe" "C:\Users\Mohamed\......\1.txt"
@MooingDuck C:\Users\Mohamed>
@MohamedAhmedNabil alright. The reason is says that, is that is the "current working directory" (CWD)
That is where it will look for all unqualified file names first.
type in the command "PATH"
and it will show you the rest of the places it looks for files.
@MooingDuck but when i go and press Start debugging i can type in "1.txt"
@MohamedAhmedNabil Visual Studio sets the CWD to the project folder when debugging.
each program has it's own CWD
@MooingDuck ooh. so the program opens with the CMD's CWD?
so either (A) have the program change the CWD, or (B) change the CWD before running the program
@MohamedAhmedNabil right.
21:51
@MooingDuck why?
@MohamedAhmedNabil historical reasons I think. Not sure. I think it used to be one CWD for the whole computer (DOS). CMD kinda sorta keeps that tradition.
@MooingDuck You said that i should have the program change the CWD. How can i do that?
msdn.microsoft.com/en-us/library/windows/desktop/… for details on setting the CWD on windows
if( !SetCurrentDirectory(argv[1]))
   {
      printf("SetCurrentDirectory failed (%d)\n", GetLastError());
      return;
   }
I've never done it, but it looks really straighforward :D
@MooingDuck C :/
@MohamedAhmedNabil C what?
21:54
@MooingDuck Hasnt C programming gone obsolete?
@MohamedAhmedNabil I wish :(
@MooingDuck btw, When are the Turing Award given?
@MohamedAhmedNabil The "turing test" is a theoretical test. There's many seperate actual tests.
@MooingDuck oh ok
Thanks for your help. Appreciate it :D
22:10
The Turing test is a test of a machine's ability to exhibit intelligent behaviour. In the original illustrative example, a human judge engages in a natural language conversation with a human and a machine designed to generate performance indistinguishable from that of a human being. All participants are separated from one another. If the judge cannot reliably tell the machine from the human, the machine is said to have passed the test. The test does not check the ability to give the correct answer; it checks how closely the answer resembles typical human answers. The conversation is lim...
@MooingDuck I thought it was like an award
@MohamedAhmedNabil it might be a security thing. I dunno.
@MooingDuck Isnt it the nobel prize of computer science?
@MohamedAhmedNabil "The Loebner Prize provides an annual platform for practical Turing Tests with the first competition held in November, 1991"
@MohamedAhmedNabil what? no.
@MooingDuck I was wondering. Can i enter competition with programs that are "BLACK AND WHITE" programs?
22:13
"BLACK AND WHITE" programs?
Win32 console appliaction
That Looks like a Dos screen
depends on the competition. Most compititions are only console programs.
read from std::cin, do calculations, write to std::cout, and close. Competitions might measure accuracy, time, memory, clarity, or other things.
I'm not sure what the official term is. "command line programs" I think.
@MooingDuck There are competitions like that ^.^ Do you think i stand a chance at wining?
*winning
@MohamedAhmedNabil you're still learning a lot, but most competitions show everyones code at the end, so you can see what others did and learn. Heck, you don't even have to enter. They're fun either way.
@MooingDuck But, for a beginner how would you rate me?
22:30
@MohamedAhmedNabil Its hard to rate such a thing. You're less of a beginner than some, more than others, still definitely a beginner. You seem to be learning, you're progressing at a good speed. shrug
You won't win any competitions, but you have enough skill to enter some of them now.
I like making my programs super fast, so I use codechef.com/problems/easy when I feel like competing
codechef is like the only online public competition that times runs. Most just make hard puzzles
about.com also has some monthly programming challenges which I find more interesting, and they vary in difficulty, but are usually easyish.
Thanks :D
@MooingDuck Do you personally use #define or just write values?
lots of people like euler, but I don't personally. Too much math, not enough tricks.
@MohamedAhmedNabil global constants or enums.
define should be avoided in most cases
22:58
@MooingDuck did you hear about thinkquest?
nope, haven't heard of a lot of things though.
Check the 17 and under part.
Its a worldwide competition, There is a part for application developers. One from 18-22 and the other is for under 17
1st place was a houshold economic simulator. second place was a Encrypter/ Decrypter and the third was a random password generator.
@MooingDuck Do you think this will be too hard for me?
@MohamedAhmedNabil I have no idea, I'm not interested in looking at that project right now, sorry.
@MooingDuck oh no problem ^.^

  last day (22 days later) »