From: Daniel on
I'm trying to write to a file using fprintf_s a value of type unsigned long
long, using the format specifiers "%ld". However, when I open the text
file, I see incorrect values. I think I am using the wrong type specifiers.
I can't find the correct information in the help section. Does anyone know
what format specifiers I need to use? Here is my code:

fprintf_s(cfPtr, "%lu\n", number);


From: Igor Tandetnik on
"Daniel" <Mahonri(a)cableone.net> wrote in message
news:OKy0ejgpIHA.3456(a)TK2MSFTNGP05.phx.gbl
> I'm trying to write to a file using fprintf_s a value of type
> unsigned long long, using the format specifiers "%ld"

%ld is plain vanilla long. You want %llu or %I64u
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


From: Daniel on
I just tried those two suggestions, but I still get the same problem.

"Igor Tandetnik" <itandetnik(a)mvps.org> wrote in message
news:erh%23kqgpIHA.672(a)TK2MSFTNGP02.phx.gbl...
> "Daniel" <Mahonri(a)cableone.net> wrote in message
> news:OKy0ejgpIHA.3456(a)TK2MSFTNGP05.phx.gbl
>> I'm trying to write to a file using fprintf_s a value of type
>> unsigned long long, using the format specifiers "%ld"
>
> %ld is plain vanilla long. You want %llu or %I64u
> --
> With best wishes,
> Igor Tandetnik
>
> With sufficient thrust, pigs fly just fine. However, this is not
> necessarily a good idea. It is hard to be sure where they are going to
> land, and it could be dangerous sitting under them as they fly
> overhead. -- RFC 1925
>


From: Igor Tandetnik on
"Daniel" <Mahonri(a)cableone.net> wrote in message
news:u3VJP1ipIHA.3408(a)TK2MSFTNGP03.phx.gbl
> I just tried those two suggestions, but I still get the same problem.

Show your code, what you expect to see, and what you actually see in the
file.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


From: Tamas Demjen on
Igor Tandetnik wrote:

>> I'm trying to write to a file using fprintf_s a value of type
>> unsigned long long, using the format specifiers "%ld"
>
> %ld is plain vanilla long. You want %llu or %I64u

It's very hard to be 100% portable with this:
VC++: %I64u or %llu
GNU g++, Solaris: %llu
Borland: %Lu or I64u

Tom