Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Breaking a string in to different varibels with sscanf

Author
Message
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 29th Apr 2010 13:36
ok i had a post back on breaking a string into numbers using sscanf and now i have a problem when i try to send to send it to char* strings.

it works with numbers thou.


im still learning this part so if you can help me fix the problem explain it to me please? thank you.

Problem Solution That Never Fails: "Build A Bridge And Get Over It"
RichBurb
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: The Dark Side of the Moon
Posted: 29th Apr 2010 18:31
http://msdn.microsoft.com/en-us/library/w40768et(VS.80).aspx
The link above is to an MSDN article which might be of help.

scanf_s and wscanf_s require the buffer size to be specified for all input parameters of type c, C, s, S, or [. The buffer size is passed as an additional parameter immediately following the pointer to the buffer or variable. For example, if reading a string, the buffer size for that string is passed as follows:

char s[10];

scanf("%9s", s, 10);

The buffer size includes the terminating null. A width specification field may be used to ensure that the token read in will fit into the buffer. If no width specification field is used, and the token read is too big to fit in the buffer, nothing will be written to that buffer.


This example uses char arrays instead of char*
Freedom Fighters
14
Years of Service
User Offline
Joined: 2nd Nov 2009
Location:
Posted: 30th Apr 2010 15:05
ok thanks now i understand it. still making some sense of this stuff.

thanks many and for being helper to me.

Problem Solution That Never Fails: "Build A Bridge And Get Over It"

Login to post a reply

Server time is: 2024-07-07 01:19:07
Your offset time is: 2024-07-07 01:19:07