Pelles C forum

C language => Beginner questions => Topic started by: P_C on February 08, 2011, 05:38:14 pm

Title: *.out file
Post by: P_C on February 08, 2011, 05:38:14 pm
Hi!
I want to make a *.out file for my program but the Pelles C command prompt says "access denied".
So what to do? because i need to show my program to the teacher.
Title: Re: *.out file
Post by: Vortex on February 08, 2011, 08:26:51 pm
Hi P_C,

Is there a NTFS permisson issue on the folder where you want to create the output file?
Title: Re: *.out file
Post by: P_C on February 08, 2011, 08:55:23 pm
I don't know, how to check that?
Title: Re: *.out file
Post by: Stefan Pendl on February 08, 2011, 09:09:40 pm
What is the path you like to put your file in?
What Windows version are you running on?
Title: Re: *.out file
Post by: P_C on February 08, 2011, 09:18:27 pm
the path is C:\Users\x\Documents\Pelles C Projects\
and I am running on Win7 64bit.
Title: Re: *.out file
Post by: Stefan Pendl on February 08, 2011, 09:50:14 pm
So you are saving to your own documents?

There should be no problem doing so, if the file does not exist and is not used by another program.
Title: Re: *.out file
Post by: CommonTater on February 09, 2011, 02:46:59 am
So you are saving to your own documents?

Two things may be of note here...
1) does that folder actually exist? 
2) some command line tools have problems with spaces in path names.
Title: Re: *.out file
Post by: P_C on February 09, 2011, 02:40:47 pm
I am typing "goto *path*" and then "*.exe>*.out" and it says access denied. maybe i am wrong?
Title: Re: *.out file
Post by: CommonTater on February 09, 2011, 03:03:06 pm
Exactly what are you typing... a screenshot would be good...
Title: Re: *.out file
Post by: Vortex on February 09, 2011, 09:23:26 pm
the path is C:\Users\x\Documents\Pelles C Projects

Your project files are under your profile folder so you shouldn't have NTFS permisson issues.
Title: Re: *.out file
Post by: P_C on February 09, 2011, 10:21:17 pm
(http://img135.imageshack.us/img135/3826/129728645133.png) (http://www.fxp.co.il)
Title: Re: *.out file
Post by: Stefan Pendl on February 09, 2011, 10:44:09 pm
Goto does not change the folder, but jumps to a mark when used inside a batch file.

You need to use CD (change directory) instead.

The program files folder structure is write protected, only installers are allowed to write there.
Title: Re: *.out file
Post by: Bitbeisser on February 12, 2011, 01:32:47 am
Goto does not change the folder, but jumps to a mark when used inside a batch file.

You need to use CD (change directory) instead.

The program files folder structure is write protected, only installers are allowed to write there.
Well, that's not the problem here though, don't know if the fact that goto works here in the first place is a new thing in Windows 7 (Vista?).

The main issue is that he expects to be able to execute an .out file and that is certainly not going to happen. It has to be a .com or .exe file, after all this ain't Linux/Unix he's running on. Not sure if Windows 7/Vista is still recognizing the .cmd extension as it was used in early NT and OS/2...

Ralf
Title: Re: *.out file
Post by: CommonTater on February 12, 2011, 02:07:23 am
I'm on win7 and goto does what it always has... jumps to a label inside a batch program.

The correct command is CD  or CHDIR followed by the path where you want to be.
You will know when it works because the path showing to the left of the cursor will change to match your target...

Code: [Select]
start a shell...

c:\users\name> _     <--- type CD \WINDOWS
c:\Windows> _

I think the whole problem is that he's just not getting into the right directory.
Title: Re: *.out file
Post by: Bitbeisser on February 12, 2011, 04:18:05 am
I'm on win7 and goto does what it always has... jumps to a label inside a batch program.

The correct command is CD  or CHDIR followed by the path where you want to be.
You will know when it works because the path showing to the left of the cursor will change to match your target...

Code: [Select]
start a shell...

c:\users\name> _     <--- type CD \WINDOWS
c:\Windows> _

I think the whole problem is that he's just not getting into the right directory.





c:\CD C:\
My bad, you're right, the goto doesn't even work as I wrongly assumed it could.
I was checking the forum earlier from my Android phone, and didn't see the blackslashes and pointy brackets right.

He is not actually changing the directory to his project folder and then tried to execute the exercize4c.exe in "C:\Program Files\Pelles C", with an attempted redirection of it's possible output to the file exercize4c.out.

What more so was throwing me off is that the GOTO command doesn't throw an error message about a non-existing label and unless the exercize4c.exe is indeed in the current folder, I would have expected an error message like "command not found" when trying to execute the file in the wrong folder...  ???

Ralf
Title: Re: *.out file
Post by: CommonTater on February 12, 2011, 12:46:23 pm
Next time you're on a windows machine, open a command shell and type  help then hit enter.  That'll give you the commands and what they do.
Title: Re: *.out file
Post by: MichaelT on February 22, 2011, 12:56:21 am
Have you tried: Right click on .exe file and set program to run 'As administrator' ? Alternatively, set it to Run as 'you-own-account' (Sounds weird, but is actually
required sometimes)

What is more, you should not try and 'GOTO' a file unless it is script related. And even then, it should be inside a script and not on the commandline.
'goto' will not report an error as there is nothing wrong to report. 'Call' on the other hand, does work on the commandline.

For example: goto anything > tryme.txt would yield a 0-byte file, even if there would be a script\exe file called 'anything' there. It simply does, nothing.