Monday, September 28, 2009

Software Engineering Day 1 Lab 1 Notes.

Here are the notes for SWE L1

relativePath = \dir1\dir2\somefile.txt

CurrWorkDir = "C:\SomeFolder\"

char [] token = "\\";

fstream mystream;
mystream.open(filename,flags);

flags
std::ios_base::in, out, trunc, binary, app, ate

ate - puts our read and write pointers at the end of the file

seekp - seeks the write pointer
seekg - seeks the read pointer

seekp(num of bytes you want to seek, where you want to seek from);

seekp(0,std::ios_base::beg);
cur
end



// existing ioPakFile;
fstream fileIn;
ioPakFile.seekp(dir offset, std::ios_base::beg);
char buffer[256];
unsigned int nRead;
unsigned int nTotal = 0;

while(fileIn.good())
{
fileIn.read(buffer,256);
nRead = fileIn.gCount();
ioPakFile.write(buffer,nRead);
nTotal += nRead;

}
fileIn.close();
//EVERYTIME YOU MUST CLEAR IT AFTER YOU CLOSE
fileIn.clear();
//YOU MIGHT WANT TO CLEAR BEFORE YOU OPEN AGAIN

No comments:

Post a Comment