DOC PREVIEW
USC EE 450 - EE450-Discussion02-Fall-2016 (1)

This preview shows page 1-2-3-4-5-6-39-40-41-42-43-80-81-82-83-84-85 out of 85 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 85 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

EE450 Discussion 2 A Brief Introduction to Software Development in C Outline n S FTP Clients q n X Window Clients q n learn how you can upload download files to from a server learn how you can execute remote commands in a Unix server Introduction to programming in C C S FTP Clients To transfer files from to your local machine to from Nunki use any of the following WinSCP FileZilla Windows Cyberduck FileZilla Fetch Mac FileZilla Linux or any other S FTP client scp command etc See http www usc edu its sftp for more details WARNING DO NOT delete any files you DID NOT create on the server You might not be able to execute commands correctly S FTP Clients Cont d FileZilla See here http itservices usc edu sftp filezilla File Editors n To remotely edit files e g your C C source code on Nunki q you can either use file editors such as emacs or vi that come with your UNIX environment n http itservices usc edu unix editors vi n http itservices usc edu unix editors emacsreference q or you can use an editor from inside the S FTP client you use easier n Use either the default editor that each S FTP client comes with n Or a third party editor that you can download and open from inside the S FTP client q Notepad Sublime Text Windows q Xcode Sublime Text Mac q GEdit Kate KEdit etc Linux How to connect Remotely to Nunki n n To execute remote commands on Nunki If you use Windows q You need to download install and run X Win and VPN on your computer n Open software usc edu in you web browser n Login using your USC username and password n Select your operating system n Download the latest X Win and VPN n Install them both on your computer n Check http itservices usc edu unix xservers xwin32 for more info n Run and login to VPN run X Win configure an SSH session for nunki and login to nunki n If X Win does not work on your machine e g if you use Win 8 you can q q n n download MobaXTerm from http mobaxterm mobatek net download home edition html Or download Putty from software usc edu If you use Mac or Linux q Just use the pre installed Terminal application instead of X Win q Run the command ssh X yourusername nunki usc edu WARNING Don t delete any files you did not create from the server How to connect Remotely to Nunki Cont d n Xwin How to connect Remotely to Nunki Cont d n Select SSh How to connect Remotely to Nunki Cont d Fill out as in shown How to connect Remotely to Nunki Cont d How to connect Remotely to Nunki Cont d n n n n The new connection will be added to you connection list under My Connections Select the connection Click on the Launch button Enter the Username and the password How to connect Remotely to Nunki Cont d Now you can execute your UNIX command How to connect Remotely to Nunki Cont d n Putty nunki usc edu Introduction to C C Strategies for learning C n n Focus on concepts and programming techniques Don t get lost in language features Learn C to become a better programmer q n n n n More effective at designing and implementing C supports many different programming styles Learn C gradually Don t have to know every detail of C to write a good C program Implement full working examples to see how they work q See also here http www cplusplus com doc tutorial In a Nutshell Hello World in C n Our first program in C Hello World my first program in C with comments include iostream using namespace std int main cout Hello World prints Hello World return 0 n n n After you are connected to Nunki create a text file named hello cpp and copy paste the source code shown above In the command line run g hello cpp q This generates an executable a out It can be executed with a out Alternatively run g o somename hello cpp q Run it with somename Comments n How to make comments n In C q n a a b comment in C In C q q a a b line comment a a b block comment block comment block comment Variable declaration n In C all variable definitions must occur at the beginning of a block q n Example int i for i 0 i 5 i In C variable definitions may occur at the point of use q Example for int i 0 i 5 i Identifiers n n n n C reserved keywords that can not be used as an identifier asm auto bool break case catch char class const const cast continue default delete do double dynamic cast else enum explicit extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret cast return short signed sizeof static static cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar t and and eq bitand bitor compl not not eq or or eq xor xor eq far huge near for some compiler Boolean n Built in type bool n In C true is represented by nonzero integer values and false by zero n In C type bool is added to represent boolean values A bool object can be assigned the literal value true and false Boolean n n n n n n Example int f int bool flag1 flag2 flag1 false flag2 f 5 A zero value or a null pointer value can be converted to false implicitly all other values are converted to true Constant n In C Constants are handled by the preprocessor through macro substitution q q define MAX 10 define MAX f 5 wrong Declared Constants n n n n n In C The keyword const allows explicit definition of constants objects max and a cannot be modified after initialization const int max 10 const int a f 5 void f int i const int j j is treated as a constant in f i ok j 2 error Cast Type Conversion n n n n n n Cast Type conversion In C double a In C functional notation Example average double sum double count Other C type conversion operator for Object Oriented programming q static cast const cast reinterpret cast dynamic cast Structure n n In C The keyword struct denotes a type aggregation of elements of arbitrary type Two structures are different even when they have the same members struct student char name 20 int id student s1 struct new student char name 20 int id new student s2 s1 s2 Wrong Two different types Function Prototype n n n n n In C function prototyping is required to type check function calls Format for prototype q type name argument type1 argument type2 It does not include a statement for the function no …


View Full Document

USC EE 450 - EE450-Discussion02-Fall-2016 (1)

Download EE450-Discussion02-Fall-2016 (1)
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view EE450-Discussion02-Fall-2016 (1) and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view EE450-Discussion02-Fall-2016 (1) and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?