Question

What is the fastest way to move to 100 bytes before the end of a file...

What is the fastest way to move to 100 bytes before the end of a file when editing it using system calls?

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hey, you haven't specified the specific language for this problem. So, gave some brief information about it:

  1. For C / C++: To transfer or move 100 bytes before ending file you can use fseek, lseek.                    Move from specific position: SEEK_SET, SEEK_CUR, SEEK_END.                               lseek is the fastest to move content.
  2. For JAVA: One of the best ways is that-                                                                                       #make an appropriately sized buffer                                                                                         #perform I/O operations and fill the buffer using InputStream                                                   #manipulate the buffer                                                                                                     #perform I/O operations and flush the buffer to the disk using OutputStream
  3. In python, you can use Buffered Binary File Types.

You can also use one of the systems calls called UNIX System Calls.

Add a comment
Know the answer?
Add Answer to:
What is the fastest way to move to 100 bytes before the end of a file...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use a system call Iseek() to move a file pointer to 50 bytes after the beginning...

    Use a system call Iseek() to move a file pointer to 50 bytes after the beginning of a file? (5 pts) Note that: SEEK SET The file offset is set to offset bytes. SEEK_CUR The file offset is set to its current location plus offset bytes. SEEKEND The file offset is set to the size of the file plus offset bytes.

  • 1. The fastest way to do labels for envelopes is using PivotTables. A. True B. False...

    1. The fastest way to do labels for envelopes is using PivotTables. A. True B. False 2. When you insert a chart into Word using a simple copy+paste process, the chart will be editable using the Picture Tools. A. True B. False 3. The RIGHT function returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify. A. True B. False 4. When you paste an image...

  • When is a bouncing mass at the end of the spring the fastest? What is the...

    When is a bouncing mass at the end of the spring the fastest? What is the kinetic energy?

  • 1. (10 pts) What is the largest file size if the inode is as follows: size of the inode is 128 Bytes out of which 64 Bytes are used for layout information, . each pointer is of size 8 Bytes and the f...

    1. (10 pts) What is the largest file size if the inode is as follows: size of the inode is 128 Bytes out of which 64 Bytes are used for layout information, . each pointer is of size 8 Bytes and the file system block size is 4 KBytes, the inode has 2 direct pointers, 2 single indirect pointers, 2 double indirect pointers, and 2 triple indirect pointers 2. (10 pts) Find the average seek time (under the assumptions we...

  • Page size is 1K bytes, and the avg record size is 100 bytes. Given 1 million...

    Page size is 1K bytes, and the avg record size is 100 bytes. Given 1 million records in a table, answering the following questions. 1) Suppose the table is stored in a heapfile, how many pages are in this file? 2) We will build an unclustered index B+ tree on this table over attribute A, how many data entries are contained in the leaf level? 3) Suppose A is integer type, what’s the size of a data entry? 4) Suppose...

  • File structure is a structure, which is according to a required format that operating system can...

    File structure is a structure, which is according to a required format that operating system can understand. A file has a certain defined structure according to its type. A text file is a sequence of characters organized into lines. A source file is a sequence of procedures and functions. An object file is a sequence of bytes organized into blocks that are understandable by the machine. When operating system defines different file structures, it also contains the code to support...

  • The following code is meant to capture the output of an executable in a file and...

    The following code is meant to capture the output of an executable in a file and then read in and print out the first 100 bytes of that file. Select all of the bugs in the code. Assume that all system calls succeed and that sizeof(char)-1. pid_t pid = fork(); if (pid == 0) { int in-open("file.txt", READONLY) dup2(STDOUT FILENO, in); execl("./something", "something", "hello!"); l else char buffer[100] int in = open("file.txt'. READ-ONLY): read(buffer, in, 100); The parent does not...

  • 11. Consider a file system that uses a structure similar to an i-node with the following...

    11. Consider a file system that uses a structure similar to an i-node with the following differences. If the file size is less than 100 bytes, the data is stored directly in the i-node. If it is larger, there are 6 direct links (point to a data block), 1 single-indirect links, 2-double indirect links and 1 triple indirect link. (a) What is the largest file size that can be indexed in this system? Assume the block size is 512 bytes....

  • 32 bytes of memory. 16 bytes of 2-way set-associative cache, where blocks can go anywhere within...

    32 bytes of memory. 16 bytes of 2-way set-associative cache, where blocks can go anywhere within the set. Block is 2 bytes, set in cache is two blocks. Populate memory starting with upper-case letters, then 0-5. Hint- with full associativity in the set: each block has its own set of Tag bits in the cache. Memory is not organized by sets, though blocks get assigned to sets, and load in the cache per set.
1) Break down the addressing: Tag...

  • Part B Consider a file system that uses a structure similar to an i-node with the...

    Part B Consider a file system that uses a structure similar to an i-node with the following differences. If the file size is less than 100 bytes, the data is stored directly in the i-node. If it is larger, there are 8 direct links (point to a data block), 2 single-indirect links, 1-double indirect links and 1 triple indirect link. What is the largest file size that can be indexed in this system? Assume the block size is 1024 bytes....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT