Bs47 C
Results 1 to 2 of 2

Thread: Bs47 C

  1. #1
    Member
    Join Date
    Oct 2003
    Posts
    81

    Bs47 C

    Operating System: UNIX
    Editor: Vi or Pico
    Development Language: ANSI C
    Development Mainframe: bs47c


    Hi

    the above is my setup on my system, I was wondering whether anyone has info ( ie commancds, how to loads files, open files etc ) for the above system. As im trying to learn C . Thought i know C im just trying to get the hang of this system.

    thanks

  2. #2
    Custom User
    Join Date
    Oct 2001
    Posts
    503
    I would use vi if I were you. Pico can be quite nice to start with, but apart from anything else, many systems only have vi installed. I'll give you some basic info that should hopefully be enough to get you started:

    First get yourself to the directory where you want to open/create a file. Say that you are in /home/bob and your file is /home/bob/c/hello.c you could either type "cd /home/bob/c" or "cd c" to get to the directory that the file is in (both without quotes).

    Now that you are in the correct direcory, you might want to list all the files that are there; perhaps you've forgotten the name of your file or something like that. You would type "ls -a". If there are a lot of files and the list is going to scroll off the screen you can type "ls -a | more" (or | less, depending on your preference). What this does is sends the output of ls (a list of the files in the directory) to the program more (or less). This program will allow you to scroll through the list of files either a line at a time or a page at a time by pressing the key it prompts you to press.

    Ok, now for opening the file. You've realised that your file is called hello.c and you want to open it using vi. Simply type "vi hello.c". Your file will now be opened in vi. Make sure you press "i" before attempting to type in any text because otherwise one of the other keys might modify the behavior of vi and do something nasty to your file. (When you open vi it is not in insert mode, it waits for a mode to be set by the user pressing a certain key).

    You now have your file either written or edited in some way and you want to save it. Press "[esc] [shift]+: w [enter]". In English, that means press the escape key then holding down shift press ":" (colon). Now press "w" then enter. Your file will be saved. If you want to quit, "[esc] [shift]+: q [enter]".

    Note that you can add different functions together:

    "[esc] [shift]+: wq [enter]" will save (write) and quit.

    If you have opened a file and edited it and then decide that you don't want to save it, but just want to exit:

    "[esc] [shift]+: q! [enter]"

    Lastly, not that you've got your hello.c program that will undoubtadely say, "hello world," or some crap like that you want to compile it, right? I'll assume that you've got gcc (didn't sound like you did from your post, but hey). To compile your hello.c to the binary hello file, type:

    "gcc hello.c -o hello"

    [ac@ezranet ac]$ gcc hello.c -o hello
    Process complete, no errors
    [ac@ezranet ac]$

    Ok, I doubt it will say process complete, no errors. It's been a while since I've used gcc, so I can't remember what it will look like, but hopefully you get the gist. Now you want to run the file. Type "./hello". If it says "Permission denied" or something like that, don't panic. It just means that you need to set the priviledges of the file. Type "chmod 700 hello" And then try to run the file again. It should work.

    For all the commands I've mentioned in this post there should be a man page. If you want to find out more about them, more advanced features, etc type:

    "man x" Where x is substituted for a command (such as ls, more, less, gcc, chmod, vi, etc).

    Also, if you don't have gcc, just type in the name of your compiler (the name of the program, that is, like cc or g++) instead of gcc, the syntax for the command should be the same.

    ac

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides