Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to read a date and time in format YYYYMMDD without using any symbol such as / or - from txt file using fscanf...how can i seperate year,month, days by using fscanf..please help me!
Posted

 
Share this answer
 
Specify the width for the elements:
C++
int nYear, nMonth, nDay;
fscanf(f, "%4d%2d%2d", &nYear, &nMonth, &nDay);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900