| | |
User Defined function on time
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Solved Threads: 0
hi , i'm writing a user define function for time i don't know is it correct.. need help
here are my code
here are my code
C++ Syntax (Toggle Plain Text)
void Time(char buffer[256], time_t curtime , struct tm *loctime) { curtime = time (NULL); loctime = localtime (&curtime); fputs (asctime (loctime), stdout); strftime (buffer, 256, "Today is %A, %B %d.\n", loctime); fputs (buffer, stdout); strftime (buffer, 256, "The time is %I:%M %p.\n", loctime); fputs (buffer, stdout); return 0; }
Last edited by Ancient Dragon; Sep 26th, 2007 at 9:06 am. Reason: add code tags
>> i don't know is it correct
Compile and test it and find out if its correct or not.
1. There is no need for the second and third parameters to that function and possibly not even the first parameter. You can make all those parameters local to that function because the calling function will not be able to see them.
2. Delete the return 0 last line because void functions to not return anything.
Compile and test it and find out if its correct or not.
1. There is no need for the second and third parameters to that function and possibly not even the first parameter. You can make all those parameters local to that function because the calling function will not be able to see them.
2. Delete the return 0 last line because void functions to not return anything.
Last edited by Ancient Dragon; Sep 26th, 2007 at 9:10 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
![]() |
Similar Threads
- Can we call a User defined Function using Linked Servers ? (MS SQL)
- User-defined functions (C++)
- User-Defined Function - part 2 (C++)
- Passing a matrix from main function to user defined function. (C++)
- How can I create a user defined function (MS SQL)
- error in user defined string class (C++)
- using(STL)function object (bind2nd) with a user defined function object (C++)
Other Threads in the C++ Forum
- Previous Thread: Some math and MFC
- Next Thread: Need to send output to notepad
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete deploy desktop developer directshow dll dynamiccharacterarray email encryption error file forms fstream function functions game getline givemetehcodez google graph homeworkhelp homeworkhelper iamthwee ifstream input int integer lib linkedlist linux list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct template templates text tree unix url vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






