Notes - 2.27 - != If fread I sizeof 1 1 fp 1& = I...

Info icon This preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
E E 312 Notes / / 2 27 08 = Argc number of pointers * [] = Char argv each value that is passé into function ( , * []) Int main int argc char argv Command line > . myprog c one two three = Argc 4 [ ] = “ . ” Argv 0 my prog c [ ]=” Argv 1 one [ ] = “ Argv 2 two [ ] = “ Argv 3 three / File i o functions begin with f something = Fprintf printf but in the fline , , Fopen fopen fscanf Binary Streams sequence of bits In unix there is no difference Binary files require a b with every input output , () For binary use fwrite function Returns a value = ; * ; Int I 100 FILE fp ( (& , ( ), , ) != ) If fwrite I sizeof i 1 fp 1 & = i address of i ( ) = = Sizeof 1 Returns number of bits 4 bits big = 1 1 value = Fp writes to this file , If in arrays can write out values at one time , If it s a single value must use multiple fwrites , () For binary use fread function Reads a value stored in memory up to a value at an address ; * Int i FILE fp ( (& , ( ), , ) != ) If fread I sizeof 1
Image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: , ) != ) If fread I sizeof 1 1 fp 1 & = I address for file to be stored ( ) = Sizeof 1 the number of bits to be read = 1 number of values to be read = Fp source location ( , , ) – Fseek fp 0 seek_set used to move around a file = Fp pointer from file = ( ) the offset number in bytes from the position = ( = , = , = )] Seek_set position that you are at SET beginning END end CUR current ( ) – Ftell fp tells you where you are at = Fp pointer from from file Able to capture where you are at for future reference ( ) – Rewind fp means go back to end beginning of file Array sizes = Double 8 bits = Float 4 bits = Int 2 bits * = 8 bits 10 values 80 bits Recursion – An anchor or base case returns a certain value for a certain parameter – And inductive or recursive case returns a function ! Example N-! = 1-! = * ( - ) N n n 1...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern