Hi all,
I encountered a problem for sscanf from a string for unsigned int
type. The warning message is
main.c: In function `main':
main.c:171: warning: unsigned int format, different type arg (arg 3)
================================================== =======
if (begin_scn) {
u_short scn_major;
u_int scn_minor;
if (sscanf(begin_scn, "%4x%*1[.:,]%8x", &scn_major,
&scn_minor)
!= 2) {
fprintf(stderr, "Wrong SCN format: %s\n", begin_scn);
return 1;
}
}
================================================== =======
Would anybody tell me how to solve this problem?
Thanks in advance! 4 5656
loudking wrote:
Hi all,
I encountered a problem for sscanf from a string for unsigned int
type. The warning message is
main.c: In function `main':
main.c:171: warning: unsigned int format, different type arg (arg 3)
================================================== =======
if (begin_scn) {
u_short scn_major;
u_int scn_minor;
if (sscanf(begin_scn, "%4x%*1[.:,]%8x", &scn_major,
&scn_minor)
!= 2) {
fprintf(stderr, "Wrong SCN format: %s\n", begin_scn);
return 1;
}
}
================================================== =======
Would anybody tell me how to solve this problem?
Thanks in advance!
Use the 'u' format specifier for unsigned int and 'hu' for unsigned
short.
"loudking" <lo******@gmail.comschrieb im Newsbeitrag
news:f9**********************************@l1g2000h sa.googlegroups.com...
Hi all,
I encountered a problem for sscanf from a string for unsigned int
type. The warning message is
main.c: In function `main':
main.c:171: warning: unsigned int format, different type arg (arg 3)
================================================== =======
if (begin_scn) {
u_short scn_major;
u_int scn_minor;
if (sscanf(begin_scn, "%4x%*1[.:,]%8x", &scn_major,
&scn_minor)
!= 2) {
fprintf(stderr, "Wrong SCN format: %s\n", begin_scn);
return 1;
}
}
================================================== =======
Would anybody tell me how to solve this problem?
Thanks in advance!
Apparently ip complains about scn_major not being an insigned int, while
scanf'c %X expects it to be just that. Try %hx for unsigned short.
Bye, Jojo
"Joachim Schmitz" <no*********@schmitz-digital.deschrieb im Newsbeitrag
news:fj**********@online.de...
"loudking" <lo******@gmail.comschrieb im Newsbeitrag
news:f9**********************************@l1g2000h sa.googlegroups.com...
>Hi all,
I encountered a problem for sscanf from a string for unsigned int type. The warning message is
main.c: In function `main': main.c:171: warning: unsigned int format, different type arg (arg 3)
================================================= ======== if (begin_scn) { u_short scn_major; u_int scn_minor;
if (sscanf(begin_scn, "%4x%*1[.:,]%8x", &scn_major, &scn_minor) != 2) { fprintf(stderr, "Wrong SCN format: %s\n", begin_scn); return 1; } } ================================================= ========
Would anybody tell me how to solve this problem?
Thanks in advance!
Apparently ip complains about scn_major not being an insigned int, while
scanf'c %X expects it to be just that. Try %hx for unsigned short.
Guess I'd better spellcheck _before_ sending...
"Apparently it complains about scn_major not being an unsigned int, while
scanf's %x expects it to be just that."
Bye, Jojo
loudking wrote:
main.c: In function `main':
main.c:171: warning: unsigned int format, different type arg (arg 3)
if (begin_scn) {
u_short scn_major;
u_int scn_minor;
if (sscanf(begin_scn, "%4x%*1[.:,]%8x", &scn_major,
&scn_minor)
!= 2) {
fprintf(stderr, "Wrong SCN format: %s\n", begin_scn);
return 1;
}
}
Would anybody tell me how to solve this problem?
Note the format specifier below:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char begin_scn[] = "00ab.721a00ac";
unsigned short scn_major;
unsigned int scn_minor;
if (sscanf(begin_scn, "%4hx%*1[.:,]%8x", &scn_major, &scn_minor)
!= 2) {
fprintf(stderr, "Wrong SCN format: %s\n", begin_scn);
return EXIT_FAILURE;
}
printf("begin_scn is \"%s\"\n"
"scn_major = %#x\n"
"scn_minor = %#x\n", begin_scn, scn_major, scn_minor);
return 0;
}
[output]
begin_scn is "00ab.721a00ac"
scn_major = 0xab
scn_minor = 0x721a00ac This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: neutrinman |
last post by:
why does the following error occur?
def quit_time():
data_file = shelve.open("data.dat", "c")
data_file = datetime.datetime.today()
print data_file
raw_input("enter")
Traceback (most...
|
by: piyushc |
last post by:
Hi,
I am having problem creating new project using VS.Net 2003.
Whenever I am trying to create new project (any type) it shows error
message
"Error writing the project file. Error loading...
|
by: Erwan |
last post by:
I have a strange (but very blocking) result when using the smtpmail
class from an ASPX page :
here is the (very simple !) code...
'--------------------------------------------------
mail.To =...
|
by: Omatase |
last post by:
Here is my code:
CDO.Message iMessage = new CDO.MessageClass();
string sFrom; string sDate;
iMessage.DataSource.Open(bstrURLItem,null,
ADODB.ConnectModeEnum.adModeRead,...
|
by: Paul E Collins |
last post by:
I'm using XmlSerializer.Serialize method from System.Xml.Serialization
on one of my own classes and getting the following error:
"An unhandled exception of type 'System.InvalidOperationException'...
|
by: madushan |
last post by:
hi all,
once i try to generate .cs file by using the aximp.exe tool
it gives the error
the command I used:
C:\Documents and Settings\malik\Desktop\tt>aximp SHDocVw.dll...
|
by: OrionLee |
last post by:
I am using C# to work with a 3rd party DLL (Nevron Charts), and attempting to serialise it. The serialisation itself is handled somewhere inside the DLL, so to get it to happen you call the Nevron's...
|
by: walex |
last post by:
Hello guys, I'm trying to install devsec an application for ffpeg for camera,but on,is a c programme,after compilation ,i now type make, then this two error are generated.common.h:67: error: array...
|
by: ravisc |
last post by:
Hi,
I had .Net 2005 framework installed in my system. I had uninstalled the same. Now I have been working with .Net 2003 develpment environment. when I try to debug any .Net 2003 project, it gives...
|
by: Greg (codepug |
last post by:
Solution Note:
I am experimenting with an excellent popup calendar I found on the
Allen Browne web site.
I was receiving the following error (Error 13: Type mismatch) when
clicking a button...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |