Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test 6 #6

Open
Scrubsauce opened this issue Apr 10, 2014 · 0 comments
Open

Test 6 #6

Scrubsauce opened this issue Apr 10, 2014 · 0 comments

Comments

@Scrubsauce
Copy link
Collaborator

Test6: Append the size and content of a file stored on the local machine in a target TFS file specified by its path.
Input: local file path, TFS file

Functionality: If the TFS file does not exists then create the specified file. Read the content of the local file, compute the number of bytes read, seek to the end of the TFS file, append a 4 byte integer pertaining to the image size, append the content in memory after these four bytes, and close the TFS file.

Example: Test6 C:\MyDocuments\Image.png 1\File1.png
If 1\File1.png exists then create the TFS file 1\File1.png. Read the content of C:\MyDocument\Image.png into an array of bytes named B and perform the following steps: 1) Let s denote the number of bytes retrieved, i.e., size of B, 2) Let delta=0, 3) Seek to offset delta of 1\File1.png, 4) Try to read 4 bytes, 5) If EOF then append 4 bytes corresponding to s followed with the array of bytes B, otherwise interpret the four bytes as the integer k and set delta=delta+4+k and goto Step 3. (The objective of the iteration is to reach the EOF.)

Assumptions: Test6 assumes a seek operation is relative to the start of the file.

Note: Make sure the definition of seek is consistent with your design definition of seek.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant