This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void create_exclusive_file(char *filename) | |
| { | |
| int fd = open(filename, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR); | |
| if (fd == -1) { | |
| printf("Error creating file: %s\n", filename); | |
| printf("Error: %s\n", strerror(errno)); | |
| return; | |
| } else { | |
| printf("Created exclusive file: %s\n", filename); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void create_exclusive_file(char *filename) | |
| { | |
| int fd = open(filename, O_RDWR); | |
| if (fd == -1) { | |
| // Check other errors here | |
| // We shall assume that we failed | |
| // due to the file not being there. | |
| // Creating file here | |
| int fd = open(filename, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); | |
| if (fd == -1) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void append_to_file(char *filename, char *line, size_t len) | |
| { | |
| off_t off; | |
| int written, closed; | |
| int fd = open(filename, O_RDWR | O_APPEND); | |
| if (fd == -1) { | |
| printf("Error opening file: %s\n", filename); | |
| printf("Error: %s\n", strerror(errno)); | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void append_to_file(char *filename, char *line, size_t len) | |
| { | |
| off_t off; | |
| int written, closed; | |
| int fd = open(filename, O_RDWR); | |
| if (fd == -1) { | |
| printf("Error opening file: %s\n", filename); | |
| printf("Error: %s\n", strerror(errno)); | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func scrollViewWillBeginDragging(scrollView: UIScrollView) { | |
| bottomMenuButtonConstraintV[1].constant -= 180.0 | |
| UIView.animateWithDuration(0.2, delay: 0.0, options: .CurveEaseInOut, animations: { | |
| self.bottomMenuButton.layoutIfNeeded() | |
| }, completion: nil) | |
| } | |
| func scrollViewDidEndDragging(scrollView: UIScrollView, willDecelerate decelerate: Bool) { | |
| if (!decelerate) { | |
| pushupPopupMenuToOriginalPlace() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| mainViewInsideScrollView = UIView(frame: mainScrollView.bounds) | |
| mainViewInsideScrollView.backgroundColor = UIColor.whiteColor() | |
| mainScrollView.addSubview(mainViewInsideScrollView) | |
| let firstView = UIView() | |
| firstView.translatesAutoresizingMaskIntoConstraints = false | |
| firstView.backgroundColor = makeUIColor(red: 246.0, green: 36.0, blue: 89.0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let logoImageViewHorizontalCenterConstraint = NSLayoutConstraint(item: logoImageView, | |
| attribute: .CenterX, relatedBy: .Equal, toItem: self.view, | |
| attribute: .CenterX, multiplier: 1.0, constant: 0.0) | |
| self.view.addConstraint(logoImageViewHorizontalCenterConstraint) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| override func prefersStatusBarHidden() -> Bool { | |
| return true | |
| } | |
| func textFieldShouldReturn(textField: UITextField) -> Bool { | |
| textField.resignFirstResponder() | |
| return true | |
| } |