#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0

    Plz help me, got stock !!


    Hi guys,

    I have 2 c program file, one of them is the main, and the other is
    data_file.txt . I'm using Linux computer, and cant run the program.
    first, I put both files in my home, then I wrote this:
    ./main data_file.txt

    but everytime I get this commment:
    permission denied.


    plz hellllllllllllllllllllllp...
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    5
    Rep Power
    0
    can you please be more specific about your problem? :confused:
    describe it in a way so that others can understand what you want to tell.

    by the way, if a file has .txt extension that means it is a TEXT file, not a C program file.
  4. #3
  5. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,392
    Rep Power
    1871
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,171
    Rep Power
    2222
    Originally Posted by hola2
    Hi guys,

    I have 2 c program file, one of them is the main, and the other is
    data_file.txt . I'm using Linux computer, and cant run the program.
    first, I put both files in my home, then I wrote this:
    ./main data_file.txt

    but everytime I get this commment:
    permission denied.


    plz hellllllllllllllllllllllp...
    A second C source file would not have a file extension of .txt, which instead is for text files. Do you instead mean that your program will read in that text file?

    I assume that you invoked gcc like this:
    gcc main.c -o main
    If not, then just what is that file main supposed to be?

    When you run ls -a main (as I recall; if -a is wrong then somebody please correct), what are the permissions that ls displays for main? In particular, what are the execute permission? Commonly, after creating an executable you need to run chmod on it to add the executable permissions -- again, I'm working from memory here so if I got that wrong, somebody else please correct.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0
    Thanks alot for your reply,

    actually my problem is that Im not familiar with c and dont have any basics on it, therefore I dont know exactly what is the "main" file for and what is the "data_file.txt" for !?

    But, I guess that the "main" contain the program and the other is just data.

    what I know that both of them are one program which is 100% correct and in some way it should work cause some other persons could run it :mad: :mad:
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2013
    Posts
    3
    Rep Power
    0
    Originally Posted by dwise1_aol
    A second C source file would not have a file extension of .txt, which instead is for text files. Do you instead mean that your program will read in that text file?

    I assume that you invoked gcc like this:
    gcc main.c -o main
    If not, then just what is that file main supposed to be?

    When you run ls -a main (as I recall; if -a is wrong then somebody please correct), what are the permissions that ls displays for main? In particular, what are the execute permission? Commonly, after creating an executable you need to run chmod on it to add the executable permissions -- again, I'm working from memory here so if I got that wrong, somebody else please correct.

    ls -a main
    this give me "main"
  12. #7
  13. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,171
    Rep Power
    2222
    And did you try the other options? Should have been ls -l main. The main thing is to check the permissions of main.

IMN logo majestic logo threadwatch logo seochat tools logo