-
Convert String to time
Hi, i have a problem over here..
I am doing C programming on Visual Studio 2005, Console Application..
I know that this can be done, but however, the compiler does not recognize some methods and my project is unable to build..
Code:
GetInformation.C
/* Author: 054094F
Nanyang Polytechnic Singapore
Visual Studio 8.0
*/
printf("Enter date of birth: (DDMMYYYY) ");
gets(dob);
if (strptime(dob, "%d%m%Y", &tm) == NULL)
printf("Invalid date please try again");
else
printf("year: %d; month: %d; day: %d;\n", tm.tm_year, tm.tm_mon, tm.tm_mday);
my error lies here
Error 20 error LNK2001: unresolved external symbol _strptime getinformation.obj
Error 21 fatal error LNK1120: 1 unresolved externals C:\Documents and Settings\User\My Documents\NYP Assignments\Year3 Sem2\IT3784 - C, Linux\054094F_Week5_ASSN\Debug\054094F_Week5_ASSN. exe
Can anyone help?
-
Don't EVER use gets().
strptime, it appears, is not part of the Microsoft library set.
You may be able to find source for strptime in Linux or NetBSD C library source code.
--
Mats
-
erm is there an alternative way to do this in visual studio?
-
It would appear that there is no such function.
http://msdn2.microsoft.com/en-gb/lib...9h(VS.80).aspx
You may try this NetBSD C library implementation. It probably requires SOME adjustment to compile in a Windows environment, but I expect it to only be small work.
http://cvsweb.netbsd.org/bsdweb.cgi/...ime.c?rev=HEAD
I got the NetBSD link from here:
http://forums.microsoft.com/MSDN/Sho...97390&SiteID=1
--
Mats