Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void init()
- initialise %appdata% location
- initialise cache files location (cache.txt and cache.bin)
- RETURN
- void getUserMenuChoice(char buffer[], int size, char *errMsg)
- WHILE TRUE
- use fgets() to get userinput
- trimmedCharArr = trimwhitespace(buffer)
- IF trimmedCharArr have string length not equal to 1
- print errMsg
- CONTINUE
- END IF
- BREAK
- END WHILE
- string copy trimmedCharArr back to buffer
- RETURN
- int chkFileExist(char *dir)
- Open file pointer pointing to dir
- IF file opened successfully
- Check file size
- IF file size == 0
- close file pointer
- RETURN 0
- END IF
- close file pointer
- RETURN 1
- END IF
- RETURN 0
- char *trimmedCharArr(char *str)
- WHILE str is pointing at space character
- move str pointer to the right by 1
- END WHILE
- IF str ended up pointing to '\0'
- RETURN str
- initialise end pointer pointer to last character of the str
- WHILE end pointer is pointing at space character
- move end pointer to the left by 1
- END WHILE
- null terminate the trimmed str (end[1] = '\0')
- RETURN str
- s_input(char *str, int size)
- rewind standard input
- use fgets() to get userinput
- Remove '\n' from input (becausee fgets() collect '\n')
- rewind standard input
- RETURN
- void getSystemDate(char dateVar[])
- Get systemdate and store in dateVar provided
- RETURN
- void getSystemTime(char timeVar[])
- Get systemtime and store in timeVar provided
- RETURN
- int validateDate(int dd, int mm, int yy)
- Checks for lunar years and month-end dates
- IF any tests failed
- RETURN 0
- END IF
- RETURN 1
- int validateTime(int h, int m, int s)
- checks for invalid time (negative numbers and such)
- IF any tests failed
- RETURN 0
- END IF
- RETURN 1
- int compareTime(int h1, int m1, int s1, int h2, int m2, int s2)
- IF both time are the same
- RETURN 0
- END IF
- Compare hours, minutues then seconds
- IF any inequalities found
- RETURN 1 if time1 is later than time2
- RETURN -1 if time2 is later than time1
- END IF
- int compareDate(int dd1, int mm1, int yy1, int dd2, int mm2, int yy2)
- IF both date are the same
- RETURN 0
- END IF
- Compare years, months, days
- IF any inequalities found
- RETURN 1 if date1 is later than date2
- RETURN -1 if date2 is later than date1
- END IF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement