Re: sscanf Programming Software Development by deceptikon > sscanf(puppy,"%[^|]%f", &p, &num); Try this instead: sscanf(puppy,"%[^|]|%f", p, &num); You forgot to extract the pipe character. Not to mention that the address-of operator is unneeded on `p` because it's already a pointer to char. Re: sscanf Programming Software Development by Banfa sscanf is not up to dealling with all those different formats. You would be better off searching the string for // and then checking to see if it is followed by a digit and then if it is using atoi or strtol to convert that to a binary value. Re: sscanf() Programming Software Development by m4ster_r0shi If you have to do it using sscanf, you could do it like this: #…path.size()]; char * cPath2 = new char[path.size()]; sscanf(path.c_str(), "%[^'/']/%[]", cPath1, cPath2); string path1(cPath1…couple of useful links -> [sscanf](http://linux.die.net/man/3/sscanf), [stringstream](http://www.cplusplus.com/… sscanf() Programming Software Development by OrangeTree Hi :). I don't found good examples for function sscanf(). Can you help me please with this situation? #include <…/articles/animals/giraffe"; char arr[256]; char arr2[256]; sscanf(way.c_str(), "%[^'/']/", arr); cout << arr <… Re: sscanf Programming Software Development by hanananah … character array and a number but am not sure if sscanf can help me. #include <stdio.h> int main…]="DOG|1.2"; char p[10]; float num; sscanf(puppy,"%[^|]%f", &p, &num); printf("… sscanf Programming Software Development by kandarpa … is //20"; char c[10], *k; int num=0; sscanf(str, "%s%[^//]*//%d",c, &num); printf("… Re: sscanf example Programming Software Development by Narue …and your keywords, i will try and see. "sscanf example". That's the first keyword search that came… was [URL="http://www.cplusplus.com/reference/clibrary/cstdio/sscanf.html"]this[/URL]. >this c/c++ thing… some trivial stuff. Wait...really? You're saying that sscanf is less trivial than the equivalent C# code? Perhaps … Re: sscanf explanation Programming Software Development by tux4life …; I assume you aren't understanding the following line: [ICODE]sscanf (sentence,"%s %*s %d",str,&i); …gt;[ICODE]sentence[/ICODE] is the string where the [ICODE]sscanf [/ICODE]function reads from, after the first comma you …s %d"[/ICODE] where [ICODE]%s[/ICODE] tells the sscanf function that the following part it will read will be… Re: sscanf explanation Programming Software Development by tux4life … [ICODE]sentence[/ICODE] is the string where the [ICODE]sscanf[/ICODE] function reads from, in the string "Rudolph is…third value is a number (an integer (%d))) Edit:: sscanf (sentence,"%s %*s %d",[ICODE]str[/ICODE],[…amp;i[/ICODE]); the higlighted parts tell the [ICODE]sscanf[/ICODE] function where to store the read and non-ignored… sscanf function Programming Software Development by rucafe …to read in each line of the code using the sscanf function. Here is what I have so far: […code] dm_Track current_track; while (myfile.good()) { getline(myfile, line); sscanf(line.c_str(), "%c %c %f %f %f %f %f…like an uninitialized value. Is anybody familiar with the sscanf function and can tell me what I can do… Re: sscanf function Programming Software Development by gerard4143 … name... [/quote] That's because your scanning a character [code] sscanf(line.c_str(), "%c %c %f %f %f %f %f… is character. Try using %s for the second specifier. [code] sscanf(line.c_str(), "%c %s %f %f %f %f %f… sscanf read error Programming Software Development by me_ansh The man page of 'sscanf' says: "EOF is also returned if a read error occurs, in which case the error indicator for the stream (see ferror(3)) is set, and errno is set indicate the error" I am confused that what kind of read error may occur if sscanf is reading from a buffer on stack??? sscanf example Programming Software Development by serkan sendur [CODE]/* sscanf example */ #include <stdio.h> #include <iostream> … = "foo -3.6 fum dum 17"; int r = sscanf(the_string, "foo %f fum dum %d", &f… Re: sscanf explanation Programming Software Development by tux4life …://www.cplusplus.com/reference/clibrary/cstdio/sscanf/"]http://www.cplusplus.com/reference/clibrary/cstdio/sscanf/[/URL] or > [URL="http…"]http://www.cppreference.com/wiki/c/io/scanf[/URL] (sscanf is just like scanf, with the difference that the input… sscanf output to array Programming Software Development by shea279 OK so how can i have sscanf scan a string with an undetermined number of separators in …;Commands::System::Windows::Accessibility::"; char ** commands_separated; //array of strings sscanf(commands,"%s::",commands_separated); [/CODE] and having the final… Re: sscanf output to array Programming Software Development by Dave Sinkula …="Red"]due to your suggestion[/COLOR]) rather than sscanf[/QUOTE]:?: I specifically recommend [I]against[/I] [ICODE]strtok[/ICODE…;; const char *ptr = line; char field [ 32 ]; int n; while ( sscanf(ptr, "%31[^[COLOR="Red"]:[/COLOR]][COLOR="… Re: sscanf fucntion Programming Computer Science by liljj2005 … [B]f[/B]ormatted [B]s[/B]tring with [B]sscanf[/B], you'd want to know the [B]f[/B…,1024); // +++ TASK // +++ extract the three substrings with sscanf // +++ into: req, resource, proto // n=sscanf(... if(strncmp(proto,"HTTP",4)!=0… Re: sscanf fucntion Programming Computer Science by Dave Sinkula You're trying to use sscanf to scan a formatted string, right? I'm asking for … to come up with a format string to use with sscanf to extract the information. What is not clear about that…] char a[10],b[100],c[50],d[10]; if ( sscanf(example, [COLOR="Red"]"%9[^:]://%99[^/]/%99[^#]#%9s… Re: sscanf read error Programming Software Development by WaltP Who says the 'buffer on the stack' is formatted properly for [icode]sscanf()[/icode]? Re: sscanf read error Programming Software Development by me_ansh … presence of two integers after the name, now by using sscanf i am reading the integers into integer variables, my question… Re: sscanf example Programming Software Development by serkan sendur even the website that originally include this example, forgot to put ampersands before variables in the function, next time when people search google using sscanf example, i want them to hit this thread, this is a good intention. Re: sscanf warning Programming Software Development by skatamatic … argument 6 has type ‘char (*)[128]’ [code] char data [ BLOCK_SIZE ]; sscanf ( inBuf, "%c %c %c %c", &mode, &… fix it. Thanks drjay[/QUOTE] Do you have to use sscanf? That's a bit outdated and not generally used, and… Re: sscanf explanation Programming Software Development by newbiecoder [QUOTE]sentence is the string where the sscanf function reads from, after the first comma you see the …following: "%s %*s %d" where %s tells the sscanf function that the following part it will read will be… Re: sscanf output to array Programming Software Development by shea279 … I tried using strtok (due to your suggestion) rather than sscanf I came up with this, but it crashes (but compiles… Re: sscanf loop Programming Software Development by mick3339 … copy of the pointer before you start modifying it. > sscanf(line, "%lf,",&array[i][j],&read…) != NULL ) { ptr=line; for (j=0;j <20 ; j++){ sscanf(ptr, "%lf,%n",&array[i][j],&… sscanf procedures Programming Software Development by klomar There are a few sscanf procedures people have written to be equivalent to the C function. I am looking for anyone with experience using any of these procedures (I will be using with Delphi 7), and any issues you may have found. Thanks. sscanf() in a loop Programming Software Development by beatlea … like this: [code] for(i=0;i<wordCounter;i++) { sscanf(input,"%s",argument[i]); } [/code] But this keeps… Re: sscanf() in a loop Programming Software Development by Narue … is a test"; char word[5]; int n; while ( sscanf ( src, "%4s%n", word, &n ) == 1 ) { puts… Re: sscanf() in a loop Programming Software Development by beatlea Sorry, but I don't understand this code :( Why do you have to use puts(word) after reading in to word with sscanf? And what does += do? Re: sscanf() in a loop Programming Software Development by Narue … to use puts(word) after reading in to word with sscanf? Because it's generally a better example if you can…