CONTENT
  • CHANGES
Szukaj
counter

#top Variable handling


code / ansic / varhandle

#top Makefile


Dla ułatwienia korzystania z przykładów został utworzony jeden zbiorczy plik Makefile kompilujący przykłady użycia poniżej wymienionych funkcji związanych z operacjami na zmiennych.

Poniższe pliki Makefile zakładają obecność wszystkich plików przykładów, w przypadku chęci kompilacji za pomocą Makefile tylko wybranego przykładu należy zakomentować w pliku Makefile ostatnią pozycję zawierającą listę wszystkich targetów do wykonania make: $(ATOF) ..., a następnie odkomentować powyżej komendę make zawierającą nazwę targetu dla bieżącego przykładu, np: w przypadku chęci kompilacji tylko przykładu atof należy zakomentować ostatnią pozycję rozpoczynającą się od make: $(ATOF) ... (wstawić na początku przed make znak #), a następnie odkomentować pozycję: #make: $(ATOF) (usunąć znak #).

#top Makefile (linux)


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_STRTOF=1 -DHAVE_STRTOLD=1 -DHAVE_STRTOQ=1 -DHAVE_STRTOUQ=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ATOF        = atof
ATOI        = atoi
ATOL        = atol
ATOLL       = atoll
STRTOD      = strtod
STRTOF      = strtof
STRTOL      = strtol
STRTOLD     = strtold
STRTOLL     = strtoll
STRTOQ      = strtoq
STRTOUL     = strtoul
STRTOULL    = strtoull
STRTOUQ     = strtouq



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ATOF)
#make: $(ATOI)
#make: $(ATOL)
#make: $(ATOLL)
#make: $(STRTOD)
#make: $(STRTOF)
#make: $(STRTOL)
#make: $(STRTOLD)
#make: $(STRTOLL)
#make: $(STRTOQ)
#make: $(STRTOUL)
#make: $(STRTOULL)
#make: $(STRTOUQ)
make: $(ATOF) $(ATOI) $(ATOL) $(ATOLL) $(STRTOD) $(STRTOF) $(STRTOL) $(STRTOLD) $(STRTOLL) $(STRTOQ) $(STRTOUL) $(STRTOULL) $(STRTOUQ)



$(ATOF): $(ATOF).o
	$(GCC) -o $(ATOF) obj/$(ATOF).o $(LDFLAGS)
$(ATOF).o:
	$(GCC) -o obj/$(ATOF).o -c $(ATOF).c $(CFLAGS)

$(ATOI): $(ATOI).o
	$(GCC) -o $(ATOI) obj/$(ATOI).o $(LDFLAGS)
$(ATOI).o:
	$(GCC) -o obj/$(ATOI).o -c $(ATOI).c $(CFLAGS)

$(ATOL): $(ATOL).o
	$(GCC) -o $(ATOL) obj/$(ATOL).o $(LDFLAGS)
$(ATOL).o:
	$(GCC) -o obj/$(ATOL).o -c $(ATOL).c $(CFLAGS)

$(ATOLL): $(ATOLL).o
	$(GCC) -o $(ATOLL) obj/$(ATOLL).o $(LDFLAGS)
$(ATOLL).o:
	$(GCC) -o obj/$(ATOLL).o -c $(ATOLL).c $(CFLAGS)

$(STRTOD): $(STRTOD).o
	$(GCC) -o $(STRTOD) obj/$(STRTOD).o $(LDFLAGS)
$(STRTOD).o:
	$(GCC) -o obj/$(STRTOD).o -c $(STRTOD).c $(CFLAGS)

$(STRTOF): $(STRTOF).o
	$(GCC) -o $(STRTOF) obj/$(STRTOF).o $(LDFLAGS)
$(STRTOF).o:
	$(GCC) -o obj/$(STRTOF).o -c $(STRTOF).c $(CFLAGS)

$(STRTOL): $(STRTOL).o
	$(GCC) -o $(STRTOL) obj/$(STRTOL).o $(LDFLAGS)
$(STRTOL).o:
	$(GCC) -o obj/$(STRTOL).o -c $(STRTOL).c $(CFLAGS)

$(STRTOLD): $(STRTOLD).o
	$(GCC) -o $(STRTOLD) obj/$(STRTOLD).o $(LDFLAGS)
$(STRTOLD).o:
	$(GCC) -o obj/$(STRTOLD).o -c $(STRTOLD).c $(CFLAGS)

$(STRTOLL): $(STRTOLL).o
	$(GCC) -o $(STRTOLL) obj/$(STRTOLL).o $(LDFLAGS)
$(STRTOLL).o:
	$(GCC) -o obj/$(STRTOLL).o -c $(STRTOLL).c $(CFLAGS)

$(STRTOQ): $(STRTOQ).o
	$(GCC) -o $(STRTOQ) obj/$(STRTOQ).o $(LDFLAGS)
$(STRTOQ).o:
	$(GCC) -o obj/$(STRTOQ).o -c $(STRTOQ).c $(CFLAGS)

$(STRTOUL): $(STRTOUL).o
	$(GCC) -o $(STRTOUL) obj/$(STRTOUL).o $(LDFLAGS)
$(STRTOUL).o:
	$(GCC) -o obj/$(STRTOUL).o -c $(STRTOUL).c $(CFLAGS)

$(STRTOULL): $(STRTOULL).o
	$(GCC) -o $(STRTOULL) obj/$(STRTOULL).o $(LDFLAGS)
$(STRTOULL).o:
	$(GCC) -o obj/$(STRTOULL).o -c $(STRTOULL).c $(CFLAGS)

$(STRTOUQ): $(STRTOUQ).o
	$(GCC) -o $(STRTOUQ) obj/$(STRTOUQ).o $(LDFLAGS)
$(STRTOUQ).o:
	$(GCC) -o obj/$(STRTOUQ).o -c $(STRTOUQ).c $(CFLAGS)



#top Makefile.obsd


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_STRTOQ=1 -DHAVE_STRTOUQ=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ATOF        = atof
ATOI        = atoi
ATOL        = atol
ATOLL       = atoll
STRTOD      = strtod
STRTOF      = strtof
STRTOL      = strtol
STRTOLD     = strtold
STRTOLL     = strtoll
STRTOQ      = strtoq
STRTOUL     = strtoul
STRTOULL    = strtoull
STRTOUQ     = strtouq



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ATOF)
#make: $(ATOI)
#make: $(ATOL)
#make: $(ATOLL)
#make: $(STRTOD)
#make: $(STRTOF)
#make: $(STRTOL)
#make: $(STRTOLD)
#make: $(STRTOLL)
#make: $(STRTOQ)
#make: $(STRTOUL)
#make: $(STRTOULL)
#make: $(STRTOUQ)
make: $(ATOF) $(ATOI) $(ATOL) $(ATOLL) $(STRTOD) $(STRTOF) $(STRTOL) $(STRTOLD) $(STRTOLL) $(STRTOQ) $(STRTOUL) $(STRTOULL) $(STRTOUQ)



$(ATOF): $(ATOF).o
	$(GCC) -o $(ATOF) obj/$(ATOF).o $(LDFLAGS)
$(ATOF).o:
	$(GCC) -o obj/$(ATOF).o -c $(ATOF).c $(CFLAGS)

$(ATOI): $(ATOI).o
	$(GCC) -o $(ATOI) obj/$(ATOI).o $(LDFLAGS)
$(ATOI).o:
	$(GCC) -o obj/$(ATOI).o -c $(ATOI).c $(CFLAGS)

$(ATOL): $(ATOL).o
	$(GCC) -o $(ATOL) obj/$(ATOL).o $(LDFLAGS)
$(ATOL).o:
	$(GCC) -o obj/$(ATOL).o -c $(ATOL).c $(CFLAGS)

$(ATOLL): $(ATOLL).o
	$(GCC) -o $(ATOLL) obj/$(ATOLL).o $(LDFLAGS)
$(ATOLL).o:
	$(GCC) -o obj/$(ATOLL).o -c $(ATOLL).c $(CFLAGS)

$(STRTOD): $(STRTOD).o
	$(GCC) -o $(STRTOD) obj/$(STRTOD).o $(LDFLAGS)
$(STRTOD).o:
	$(GCC) -o obj/$(STRTOD).o -c $(STRTOD).c $(CFLAGS)

$(STRTOF): $(STRTOF).o
	$(GCC) -o $(STRTOF) obj/$(STRTOF).o $(LDFLAGS)
$(STRTOF).o:
	$(GCC) -o obj/$(STRTOF).o -c $(STRTOF).c $(CFLAGS)

$(STRTOL): $(STRTOL).o
	$(GCC) -o $(STRTOL) obj/$(STRTOL).o $(LDFLAGS)
$(STRTOL).o:
	$(GCC) -o obj/$(STRTOL).o -c $(STRTOL).c $(CFLAGS)

$(STRTOLD): $(STRTOLD).o
	$(GCC) -o $(STRTOLD) obj/$(STRTOLD).o $(LDFLAGS)
$(STRTOLD).o:
	$(GCC) -o obj/$(STRTOLD).o -c $(STRTOLD).c $(CFLAGS)

$(STRTOLL): $(STRTOLL).o
	$(GCC) -o $(STRTOLL) obj/$(STRTOLL).o $(LDFLAGS)
$(STRTOLL).o:
	$(GCC) -o obj/$(STRTOLL).o -c $(STRTOLL).c $(CFLAGS)

$(STRTOQ): $(STRTOQ).o
	$(GCC) -o $(STRTOQ) obj/$(STRTOQ).o $(LDFLAGS)
$(STRTOQ).o:
	$(GCC) -o obj/$(STRTOQ).o -c $(STRTOQ).c $(CFLAGS)

$(STRTOUL): $(STRTOUL).o
	$(GCC) -o $(STRTOUL) obj/$(STRTOUL).o $(LDFLAGS)
$(STRTOUL).o:
	$(GCC) -o obj/$(STRTOUL).o -c $(STRTOUL).c $(CFLAGS)

$(STRTOULL): $(STRTOULL).o
	$(GCC) -o $(STRTOULL) obj/$(STRTOULL).o $(LDFLAGS)
$(STRTOULL).o:
	$(GCC) -o obj/$(STRTOULL).o -c $(STRTOULL).c $(CFLAGS)

$(STRTOUQ): $(STRTOUQ).o
	$(GCC) -o $(STRTOUQ) obj/$(STRTOUQ).o $(LDFLAGS)
$(STRTOUQ).o:
	$(GCC) -o obj/$(STRTOUQ).o -c $(STRTOUQ).c $(CFLAGS)



#top Makefile.fbsd


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_STRTOF=1 -DHAVE_STRTOLD=1 -DHAVE_STRTOQ=1 -DHAVE_STRTOUQ=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ATOF        = atof
ATOI        = atoi
ATOL        = atol
ATOLL       = atoll
STRTOD      = strtod
STRTOF      = strtof
STRTOL      = strtol
STRTOLD     = strtold
STRTOLL     = strtoll
STRTOQ      = strtoq
STRTOUL     = strtoul
STRTOULL    = strtoull
STRTOUQ     = strtouq



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ATOF)
#make: $(ATOI)
#make: $(ATOL)
#make: $(ATOLL)
#make: $(STRTOD)
#make: $(STRTOF)
#make: $(STRTOL)
#make: $(STRTOLD)
#make: $(STRTOLL)
#make: $(STRTOQ)
#make: $(STRTOUL)
#make: $(STRTOULL)
#make: $(STRTOUQ)
make: $(ATOF) $(ATOI) $(ATOL) $(ATOLL) $(STRTOD) $(STRTOF) $(STRTOL) $(STRTOLD) $(STRTOLL) $(STRTOQ) $(STRTOUL) $(STRTOULL) $(STRTOUQ)



$(ATOF): $(ATOF).o
	$(GCC) -o $(ATOF) obj/$(ATOF).o $(LDFLAGS)
$(ATOF).o:
	$(GCC) -o obj/$(ATOF).o -c $(ATOF).c $(CFLAGS)

$(ATOI): $(ATOI).o
	$(GCC) -o $(ATOI) obj/$(ATOI).o $(LDFLAGS)
$(ATOI).o:
	$(GCC) -o obj/$(ATOI).o -c $(ATOI).c $(CFLAGS)

$(ATOL): $(ATOL).o
	$(GCC) -o $(ATOL) obj/$(ATOL).o $(LDFLAGS)
$(ATOL).o:
	$(GCC) -o obj/$(ATOL).o -c $(ATOL).c $(CFLAGS)

$(ATOLL): $(ATOLL).o
	$(GCC) -o $(ATOLL) obj/$(ATOLL).o $(LDFLAGS)
$(ATOLL).o:
	$(GCC) -o obj/$(ATOLL).o -c $(ATOLL).c $(CFLAGS)

$(STRTOD): $(STRTOD).o
	$(GCC) -o $(STRTOD) obj/$(STRTOD).o $(LDFLAGS)
$(STRTOD).o:
	$(GCC) -o obj/$(STRTOD).o -c $(STRTOD).c $(CFLAGS)

$(STRTOF): $(STRTOF).o
	$(GCC) -o $(STRTOF) obj/$(STRTOF).o $(LDFLAGS)
$(STRTOF).o:
	$(GCC) -o obj/$(STRTOF).o -c $(STRTOF).c $(CFLAGS)

$(STRTOL): $(STRTOL).o
	$(GCC) -o $(STRTOL) obj/$(STRTOL).o $(LDFLAGS)
$(STRTOL).o:
	$(GCC) -o obj/$(STRTOL).o -c $(STRTOL).c $(CFLAGS)

$(STRTOLD): $(STRTOLD).o
	$(GCC) -o $(STRTOLD) obj/$(STRTOLD).o $(LDFLAGS)
$(STRTOLD).o:
	$(GCC) -o obj/$(STRTOLD).o -c $(STRTOLD).c $(CFLAGS)

$(STRTOLL): $(STRTOLL).o
	$(GCC) -o $(STRTOLL) obj/$(STRTOLL).o $(LDFLAGS)
$(STRTOLL).o:
	$(GCC) -o obj/$(STRTOLL).o -c $(STRTOLL).c $(CFLAGS)

$(STRTOQ): $(STRTOQ).o
	$(GCC) -o $(STRTOQ) obj/$(STRTOQ).o $(LDFLAGS)
$(STRTOQ).o:
	$(GCC) -o obj/$(STRTOQ).o -c $(STRTOQ).c $(CFLAGS)

$(STRTOUL): $(STRTOUL).o
	$(GCC) -o $(STRTOUL) obj/$(STRTOUL).o $(LDFLAGS)
$(STRTOUL).o:
	$(GCC) -o obj/$(STRTOUL).o -c $(STRTOUL).c $(CFLAGS)

$(STRTOULL): $(STRTOULL).o
	$(GCC) -o $(STRTOULL) obj/$(STRTOULL).o $(LDFLAGS)
$(STRTOULL).o:
	$(GCC) -o obj/$(STRTOULL).o -c $(STRTOULL).c $(CFLAGS)

$(STRTOUQ): $(STRTOUQ).o
	$(GCC) -o $(STRTOUQ) obj/$(STRTOUQ).o $(LDFLAGS)
$(STRTOUQ).o:
	$(GCC) -o obj/$(STRTOUQ).o -c $(STRTOUQ).c $(CFLAGS)



#top Makefile.sol


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_STRTOF=1 -DHAVE_STRTOLD=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ATOF        = atof
ATOI        = atoi
ATOL        = atol
ATOLL       = atoll
STRTOD      = strtod
STRTOF      = strtof
STRTOL      = strtol
STRTOLD     = strtold
STRTOLL     = strtoll
STRTOQ      = strtoq
STRTOUL     = strtoul
STRTOULL    = strtoull
STRTOUQ     = strtouq



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ATOF)
#make: $(ATOI)
#make: $(ATOL)
#make: $(ATOLL)
#make: $(STRTOD)
#make: $(STRTOF)
#make: $(STRTOL)
#make: $(STRTOLD)
#make: $(STRTOLL)
#make: $(STRTOQ)
#make: $(STRTOUL)
#make: $(STRTOULL)
#make: $(STRTOUQ)
make: $(ATOF) $(ATOI) $(ATOL) $(ATOLL) $(STRTOD) $(STRTOF) $(STRTOL) $(STRTOLD) $(STRTOLL) $(STRTOQ) $(STRTOUL) $(STRTOULL) $(STRTOUQ)



$(ATOF): $(ATOF).o
	$(GCC) -o $(ATOF) obj/$(ATOF).o $(LDFLAGS)
$(ATOF).o:
	$(GCC) -o obj/$(ATOF).o -c $(ATOF).c $(CFLAGS)

$(ATOI): $(ATOI).o
	$(GCC) -o $(ATOI) obj/$(ATOI).o $(LDFLAGS)
$(ATOI).o:
	$(GCC) -o obj/$(ATOI).o -c $(ATOI).c $(CFLAGS)

$(ATOL): $(ATOL).o
	$(GCC) -o $(ATOL) obj/$(ATOL).o $(LDFLAGS)
$(ATOL).o:
	$(GCC) -o obj/$(ATOL).o -c $(ATOL).c $(CFLAGS)

$(ATOLL): $(ATOLL).o
	$(GCC) -o $(ATOLL) obj/$(ATOLL).o $(LDFLAGS)
$(ATOLL).o:
	$(GCC) -o obj/$(ATOLL).o -c $(ATOLL).c $(CFLAGS)

$(STRTOD): $(STRTOD).o
	$(GCC) -o $(STRTOD) obj/$(STRTOD).o $(LDFLAGS)
$(STRTOD).o:
	$(GCC) -o obj/$(STRTOD).o -c $(STRTOD).c $(CFLAGS)

$(STRTOF): $(STRTOF).o
	$(GCC) -o $(STRTOF) obj/$(STRTOF).o $(LDFLAGS)
$(STRTOF).o:
	$(GCC) -o obj/$(STRTOF).o -c $(STRTOF).c $(CFLAGS)

$(STRTOL): $(STRTOL).o
	$(GCC) -o $(STRTOL) obj/$(STRTOL).o $(LDFLAGS)
$(STRTOL).o:
	$(GCC) -o obj/$(STRTOL).o -c $(STRTOL).c $(CFLAGS)

$(STRTOLD): $(STRTOLD).o
	$(GCC) -o $(STRTOLD) obj/$(STRTOLD).o $(LDFLAGS)
$(STRTOLD).o:
	$(GCC) -o obj/$(STRTOLD).o -c $(STRTOLD).c $(CFLAGS)

$(STRTOLL): $(STRTOLL).o
	$(GCC) -o $(STRTOLL) obj/$(STRTOLL).o $(LDFLAGS)
$(STRTOLL).o:
	$(GCC) -o obj/$(STRTOLL).o -c $(STRTOLL).c $(CFLAGS)

$(STRTOQ): $(STRTOQ).o
	$(GCC) -o $(STRTOQ) obj/$(STRTOQ).o $(LDFLAGS)
$(STRTOQ).o:
	$(GCC) -o obj/$(STRTOQ).o -c $(STRTOQ).c $(CFLAGS)

$(STRTOUL): $(STRTOUL).o
	$(GCC) -o $(STRTOUL) obj/$(STRTOUL).o $(LDFLAGS)
$(STRTOUL).o:
	$(GCC) -o obj/$(STRTOUL).o -c $(STRTOUL).c $(CFLAGS)

$(STRTOULL): $(STRTOULL).o
	$(GCC) -o $(STRTOULL) obj/$(STRTOULL).o $(LDFLAGS)
$(STRTOULL).o:
	$(GCC) -o obj/$(STRTOULL).o -c $(STRTOULL).c $(CFLAGS)

$(STRTOUQ): $(STRTOUQ).o
	$(GCC) -o $(STRTOUQ) obj/$(STRTOUQ).o $(LDFLAGS)
$(STRTOUQ).o:
	$(GCC) -o obj/$(STRTOUQ).o -c $(STRTOUQ).c $(CFLAGS)



#top Makefile.beos


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_STRTOF=1 -DHAVE_STRTOLD=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic
LIBS        =
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = rm -f
MKDCMD      = mkdir -p

ATOF        = atof
ATOI        = atoi
ATOL        = atol
ATOLL       = atoll
STRTOD      = strtod
STRTOF      = strtof
STRTOL      = strtol
STRTOLD     = strtold
STRTOLL     = strtoll
STRTOQ      = strtoq
STRTOUL     = strtoul
STRTOULL    = strtoull
STRTOUQ     = strtouq



all: objdir make

objdir:
	$(MKDCMD) obj/

clean: objdir
	$(RM) obj/*.o *.o *~

#make: $(ATOF)
#make: $(ATOI)
#make: $(ATOL)
#make: $(ATOLL)
#make: $(STRTOD)
#make: $(STRTOF)
#make: $(STRTOL)
#make: $(STRTOLD)
#make: $(STRTOLL)
#make: $(STRTOQ)
#make: $(STRTOUL)
#make: $(STRTOULL)
#make: $(STRTOUQ)
make: $(ATOF) $(ATOI) $(ATOL) $(ATOLL) $(STRTOD) $(STRTOF) $(STRTOL) $(STRTOLD) $(STRTOLL) $(STRTOQ) $(STRTOUL) $(STRTOULL) $(STRTOUQ)



$(ATOF): $(ATOF).o
	$(GCC) -o $(ATOF) obj/$(ATOF).o $(LDFLAGS)
$(ATOF).o:
	$(GCC) -o obj/$(ATOF).o -c $(ATOF).c $(CFLAGS)

$(ATOI): $(ATOI).o
	$(GCC) -o $(ATOI) obj/$(ATOI).o $(LDFLAGS)
$(ATOI).o:
	$(GCC) -o obj/$(ATOI).o -c $(ATOI).c $(CFLAGS)

$(ATOL): $(ATOL).o
	$(GCC) -o $(ATOL) obj/$(ATOL).o $(LDFLAGS)
$(ATOL).o:
	$(GCC) -o obj/$(ATOL).o -c $(ATOL).c $(CFLAGS)

$(ATOLL): $(ATOLL).o
	$(GCC) -o $(ATOLL) obj/$(ATOLL).o $(LDFLAGS)
$(ATOLL).o:
	$(GCC) -o obj/$(ATOLL).o -c $(ATOLL).c $(CFLAGS)

$(STRTOD): $(STRTOD).o
	$(GCC) -o $(STRTOD) obj/$(STRTOD).o $(LDFLAGS)
$(STRTOD).o:
	$(GCC) -o obj/$(STRTOD).o -c $(STRTOD).c $(CFLAGS)

$(STRTOF): $(STRTOF).o
	$(GCC) -o $(STRTOF) obj/$(STRTOF).o $(LDFLAGS)
$(STRTOF).o:
	$(GCC) -o obj/$(STRTOF).o -c $(STRTOF).c $(CFLAGS)

$(STRTOL): $(STRTOL).o
	$(GCC) -o $(STRTOL) obj/$(STRTOL).o $(LDFLAGS)
$(STRTOL).o:
	$(GCC) -o obj/$(STRTOL).o -c $(STRTOL).c $(CFLAGS)

$(STRTOLD): $(STRTOLD).o
	$(GCC) -o $(STRTOLD) obj/$(STRTOLD).o $(LDFLAGS)
$(STRTOLD).o:
	$(GCC) -o obj/$(STRTOLD).o -c $(STRTOLD).c $(CFLAGS)

$(STRTOLL): $(STRTOLL).o
	$(GCC) -o $(STRTOLL) obj/$(STRTOLL).o $(LDFLAGS)
$(STRTOLL).o:
	$(GCC) -o obj/$(STRTOLL).o -c $(STRTOLL).c $(CFLAGS)

$(STRTOQ): $(STRTOQ).o
	$(GCC) -o $(STRTOQ) obj/$(STRTOQ).o $(LDFLAGS)
$(STRTOQ).o:
	$(GCC) -o obj/$(STRTOQ).o -c $(STRTOQ).c $(CFLAGS)

$(STRTOUL): $(STRTOUL).o
	$(GCC) -o $(STRTOUL) obj/$(STRTOUL).o $(LDFLAGS)
$(STRTOUL).o:
	$(GCC) -o obj/$(STRTOUL).o -c $(STRTOUL).c $(CFLAGS)

$(STRTOULL): $(STRTOULL).o
	$(GCC) -o $(STRTOULL) obj/$(STRTOULL).o $(LDFLAGS)
$(STRTOULL).o:
	$(GCC) -o obj/$(STRTOULL).o -c $(STRTOULL).c $(CFLAGS)

$(STRTOUQ): $(STRTOUQ).o
	$(GCC) -o $(STRTOUQ) obj/$(STRTOUQ).o $(LDFLAGS)
$(STRTOUQ).o:
	$(GCC) -o obj/$(STRTOUQ).o -c $(STRTOUQ).c $(CFLAGS)



#top Makefile.win


SELECT ALL
# Project: Project
# Makefile created

GCC         = gcc
INCS        = -DHAVE_STRTOF=1 -DHAVE_STRTOLD=1
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long -D_FILE_OFFSET_BITS=64 -D_LINUX -D_REENTRANT
CFLAGS      = $(INCS) -W -O2 -Wall -pedantic -Wstrict-aliasing -Wno-long-long
LIBS        = -lm
LIBDIRS     =
LDFLAGS     = $(LIBDIRS) $(LIBS)
RM          = del /q /s
MKDCMD      = mkdir

ATOF        = atof
ATOI        = atoi
ATOL        = atol
ATOLL       = atoll
STRTOD      = strtod
STRTOF      = strtof
STRTOL      = strtol
STRTOLD     = strtold
STRTOLL     = strtoll
STRTOQ      = strtoq
STRTOUL     = strtoul
STRTOULL    = strtoull
STRTOUQ     = strtouq



all: make

objdir:
	$(MKDCMD) obj\

clean:
	$(RM) obj\*.o *.o *~

#make: $(ATOF)
#make: $(ATOI)
#make: $(ATOL)
#make: $(ATOLL)
#make: $(STRTOD)
#make: $(STRTOF)
#make: $(STRTOL)
#make: $(STRTOLD)
#make: $(STRTOLL)
#make: $(STRTOQ)
#make: $(STRTOUL)
#make: $(STRTOULL)
#make: $(STRTOUQ)
make: $(ATOF) $(ATOI) $(ATOL) $(ATOLL) $(STRTOD) $(STRTOF) $(STRTOL) $(STRTOLD) $(STRTOLL) $(STRTOQ) $(STRTOUL) $(STRTOULL) $(STRTOUQ)



$(ATOF): $(ATOF).o
	$(GCC) -o $(ATOF) obj/$(ATOF).o $(LDFLAGS)
$(ATOF).o:
	$(GCC) -o obj/$(ATOF).o -c $(ATOF).c $(CFLAGS)

$(ATOI): $(ATOI).o
	$(GCC) -o $(ATOI) obj/$(ATOI).o $(LDFLAGS)
$(ATOI).o:
	$(GCC) -o obj/$(ATOI).o -c $(ATOI).c $(CFLAGS)

$(ATOL): $(ATOL).o
	$(GCC) -o $(ATOL) obj/$(ATOL).o $(LDFLAGS)
$(ATOL).o:
	$(GCC) -o obj/$(ATOL).o -c $(ATOL).c $(CFLAGS)

$(ATOLL): $(ATOLL).o
	$(GCC) -o $(ATOLL) obj/$(ATOLL).o $(LDFLAGS)
$(ATOLL).o:
	$(GCC) -o obj/$(ATOLL).o -c $(ATOLL).c $(CFLAGS)

$(STRTOD): $(STRTOD).o
	$(GCC) -o $(STRTOD) obj/$(STRTOD).o $(LDFLAGS)
$(STRTOD).o:
	$(GCC) -o obj/$(STRTOD).o -c $(STRTOD).c $(CFLAGS)

$(STRTOF): $(STRTOF).o
	$(GCC) -o $(STRTOF) obj/$(STRTOF).o $(LDFLAGS)
$(STRTOF).o:
	$(GCC) -o obj/$(STRTOF).o -c $(STRTOF).c $(CFLAGS)

$(STRTOL): $(STRTOL).o
	$(GCC) -o $(STRTOL) obj/$(STRTOL).o $(LDFLAGS)
$(STRTOL).o:
	$(GCC) -o obj/$(STRTOL).o -c $(STRTOL).c $(CFLAGS)

$(STRTOLD): $(STRTOLD).o
	$(GCC) -o $(STRTOLD) obj/$(STRTOLD).o $(LDFLAGS)
$(STRTOLD).o:
	$(GCC) -o obj/$(STRTOLD).o -c $(STRTOLD).c $(CFLAGS)

$(STRTOLL): $(STRTOLL).o
	$(GCC) -o $(STRTOLL) obj/$(STRTOLL).o $(LDFLAGS)
$(STRTOLL).o:
	$(GCC) -o obj/$(STRTOLL).o -c $(STRTOLL).c $(CFLAGS)

$(STRTOQ): $(STRTOQ).o
	$(GCC) -o $(STRTOQ) obj/$(STRTOQ).o $(LDFLAGS)
$(STRTOQ).o:
	$(GCC) -o obj/$(STRTOQ).o -c $(STRTOQ).c $(CFLAGS)

$(STRTOUL): $(STRTOUL).o
	$(GCC) -o $(STRTOUL) obj/$(STRTOUL).o $(LDFLAGS)
$(STRTOUL).o:
	$(GCC) -o obj/$(STRTOUL).o -c $(STRTOUL).c $(CFLAGS)

$(STRTOULL): $(STRTOULL).o
	$(GCC) -o $(STRTOULL) obj/$(STRTOULL).o $(LDFLAGS)
$(STRTOULL).o:
	$(GCC) -o obj/$(STRTOULL).o -c $(STRTOULL).c $(CFLAGS)

$(STRTOUQ): $(STRTOUQ).o
	$(GCC) -o $(STRTOUQ) obj/$(STRTOUQ).o $(LDFLAGS)
$(STRTOUQ).o:
	$(GCC) -o obj/$(STRTOUQ).o -c $(STRTOUQ).c $(CFLAGS)





#top Predefined Constants


#top HUGE_VAL


Deklaracja stałej HUGE_VAL znajduje się w pliku nagłówkowym bits/huge_val.h.
Deklaracja stałej HUGE_VAL jest następująca:
/* IEEE positive infinity (-HUGE_VAL is negative infinity).  */

#if __GNUC_PREREQ(3,3)
# define HUGE_VAL       (__builtin_huge_val())
#elif __GNUC_PREREQ(2,96)
# define HUGE_VAL       (__extension__ 0x1.0p2047)
#elif defined __GNUC__

# define HUGE_VAL \
  (__extension__                                                              \
   ((union { unsigned __l __attribute__((__mode__(__DI__))); double __d; })   \
    { __l: 0x7ff0000000000000ULL }).__d)

#else /* not GCC */

# include <endian.h>

typedef union { unsigned char __c[8]; double __d; } __huge_val_t;

# if __BYTE_ORDER == __BIG_ENDIAN
#  define __HUGE_VAL_bytes      { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
# endif
# if __BYTE_ORDER == __LITTLE_ENDIAN
#  define __HUGE_VAL_bytes      { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }
# endif

static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
# define HUGE_VAL       (__huge_val.__d)

#endif  /* GCC.  */





#top Datatypes / MACROS


No Datatypes here.





#top Variable handling Functions


#top atof


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji atof() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji atof() jest następująca:
/* Convert a string to a floating-point number.  */
extern double atof (__const char *__nptr)
     __THROW __attribute_pure__ __nonnull ((1)) __wur;

Powiązane:
atof(), atoi(), atol(), atoll(),

Opis:
Funkcja atof() zwraca wartość przekonwertowaną z łańcucha znaków do postaci liczbowej (typ double) w przypadku sukcesu. Funkcja atof() zwraca wartość zero w przypadku gdy nie jest możliwe dokonanie konwersji łańcucha znaków przekazanego jako argument funkcji.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.

Zwracana wartość:
double - Postać liczbowa (typ double) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku atof.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	double doubleval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s <doublevalue>\n", argv[0]);
		printf("Examples:\n");
		printf("         %s 123\n", argv[0]);
		printf("         %s 123.456\n", argv[0]);
		printf("         %s 123.456a\n", argv[0]);
		printf("         %s 123.a456\n", argv[0]);
		printf("         %s 123a.456\n", argv[0]);
		printf("         %s a123.456\n", argv[0]);
		printf("         %s +123.456\n", argv[0]);
		printf("         %s ++123.456\n", argv[0]);
		printf("         %s -123.456\n", argv[0]);
		printf("         %s --123.456\n", argv[0]);
		return 0;
	}
	
	doubleval=atof(argv[1]);
	printf("%s: doubleval=atof(argv[1]=%s): doubleval=%f\n", self, argv[1], doubleval);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/atof
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/varhandle/atof <doublevalue>
Examples:
         /home/local/code/ansiccode/varhandle/atof 123
         /home/local/code/ansiccode/varhandle/atof 123.456
         /home/local/code/ansiccode/varhandle/atof 123.456a
         /home/local/code/ansiccode/varhandle/atof 123.a456
         /home/local/code/ansiccode/varhandle/atof 123a.456
         /home/local/code/ansiccode/varhandle/atof a123.456
         /home/local/code/ansiccode/varhandle/atof +123.456
         /home/local/code/ansiccode/varhandle/atof ++123.456
         /home/local/code/ansiccode/varhandle/atof -123.456
         /home/local/code/ansiccode/varhandle/atof --123.456

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/atof 123
/home/local/code/ansiccode/varhandle/atof 123.456
/home/local/code/ansiccode/varhandle/atof 123.456a
/home/local/code/ansiccode/varhandle/atof 123.45a6
/home/local/code/ansiccode/varhandle/atof 123.4a56
/home/local/code/ansiccode/varhandle/atof 123.a456
/home/local/code/ansiccode/varhandle/atof 123a.456
/home/local/code/ansiccode/varhandle/atof 12a3.456
/home/local/code/ansiccode/varhandle/atof 1a23.456
/home/local/code/ansiccode/varhandle/atof a123.456
/home/local/code/ansiccode/varhandle/atof +123.456
/home/local/code/ansiccode/varhandle/atof ++123.456
/home/local/code/ansiccode/varhandle/atof -123.456
/home/local/code/ansiccode/varhandle/atof --123.456
rezultat będzie zależny od podanych argumentów wywołania programu:
atof: doubleval=atof(argv[1]=123): doubleval=123.000000

atof: doubleval=atof(argv[1]=123.456): doubleval=123.456000

atof: doubleval=atof(argv[1]=123.456a): doubleval=123.456000

atof: doubleval=atof(argv[1]=123.45a6): doubleval=123.450000

atof: doubleval=atof(argv[1]=123.4a56): doubleval=123.400000

atof: doubleval=atof(argv[1]=123.a456): doubleval=123.000000

atof: doubleval=atof(argv[1]=123a.456): doubleval=123.000000

atof: doubleval=atof(argv[1]=12a3.456): doubleval=12.000000

atof: doubleval=atof(argv[1]=1a23.456): doubleval=1.000000

atof: doubleval=atof(argv[1]=a123.456): doubleval=0.000000

atof: doubleval=atof(argv[1]=+123.456): doubleval=123.456000

atof: doubleval=atof(argv[1]=++123.456): doubleval=0.000000

atof: doubleval=atof(argv[1]=-123.456): doubleval=-123.456000

atof: doubleval=atof(argv[1]=--123.456): doubleval=0.000000



#top atoi


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji atoi() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji atoi() jest następująca:
/* Convert a string to an integer.  */
extern int atoi (__const char *__nptr)
     __THROW __attribute_pure__ __nonnull ((1)) __wur;

Powiązane:
atof(), atoi(), atol(), atoll(),

Opis:
Funkcja atoi() zwraca wartość przekonwertowaną z łańcucha znaków do postaci liczbowej (typ int) w przypadku sukcesu. Funkcja atoi() zwraca wartość zero w przypadku gdy nie jest możliwe dokonanie konwersji łańcucha znaków przekazanego jako argument funkcji.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.

Zwracana wartość:
int - Postać liczbowa (typ int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku atoi.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	int intval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s <intvalue>\n", argv[0]);
		printf("Examples:\n");
		printf("         %s 123\n", argv[0]);
		printf("         %s 123.456\n", argv[0]);
		printf("         %s 123.456a\n", argv[0]);
		printf("         %s 123.a456\n", argv[0]);
		printf("         %s 123a.456\n", argv[0]);
		printf("         %s a123.456\n", argv[0]);
		printf("         %s +123.456\n", argv[0]);
		printf("         %s ++123.456\n", argv[0]);
		printf("         %s -123.456\n", argv[0]);
		printf("         %s --123.456\n", argv[0]);
		return 0;
	}
	
	intval=atoi(argv[1]);
	printf("%s: intval=atoi(argv[1]=%s): intval=%d\n", self, argv[1], intval);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/atoi
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/varhandle/atoi <intvalue>
Examples:
         /home/local/code/ansiccode/varhandle/atoi 123
         /home/local/code/ansiccode/varhandle/atoi 123.456
         /home/local/code/ansiccode/varhandle/atoi 123.456a
         /home/local/code/ansiccode/varhandle/atoi 123.a456
         /home/local/code/ansiccode/varhandle/atoi 123a.456
         /home/local/code/ansiccode/varhandle/atoi a123.456
         /home/local/code/ansiccode/varhandle/atoi +123.456
         /home/local/code/ansiccode/varhandle/atoi ++123.456
         /home/local/code/ansiccode/varhandle/atoi -123.456
         /home/local/code/ansiccode/varhandle/atoi --123.456

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/atoi 123
/home/local/code/ansiccode/varhandle/atoi 123.456
/home/local/code/ansiccode/varhandle/atoi 123.456a
/home/local/code/ansiccode/varhandle/atoi 123.45a6
/home/local/code/ansiccode/varhandle/atoi 123.4a56
/home/local/code/ansiccode/varhandle/atoi 123.a456
/home/local/code/ansiccode/varhandle/atoi 123a.456
/home/local/code/ansiccode/varhandle/atoi 12a3.456
/home/local/code/ansiccode/varhandle/atoi 1a23.456
/home/local/code/ansiccode/varhandle/atoi a123.456
/home/local/code/ansiccode/varhandle/atoi +123.456
/home/local/code/ansiccode/varhandle/atoi ++123.456
/home/local/code/ansiccode/varhandle/atoi -123.456
/home/local/code/ansiccode/varhandle/atoi --123.456
rezultat będzie zależny od podanych argumentów wywołania programu:
atoi: intval=atoi(argv[1]=123): intval=123

atoi: intval=atoi(argv[1]=123.456): intval=123

atoi: intval=atoi(argv[1]=123.456a): intval=123

atoi: intval=atoi(argv[1]=123.45a6): intval=123

atoi: intval=atoi(argv[1]=123.4a56): intval=123

atoi: intval=atoi(argv[1]=123.a456): intval=123

atoi: intval=atoi(argv[1]=123a.456): intval=123

atoi: intval=atoi(argv[1]=12a3.456): intval=12

atoi: intval=atoi(argv[1]=1a23.456): intval=1

atoi: intval=atoi(argv[1]=a123.456): intval=0

atoi: intval=atoi(argv[1]=+123.456): intval=123

atoi: intval=atoi(argv[1]=++123.456): intval=0

atoi: intval=atoi(argv[1]=-123.456): intval=-123

atoi: intval=atoi(argv[1]=--123.456): intval=0



#top atol


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji atol() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji atol() jest następująca:
/* Convert a string to a long integer.  */
extern long int atol (__const char *__nptr)
     __THROW __attribute_pure__ __nonnull ((1)) __wur;

Powiązane:
atof(), atoi(), atol(), atoll(),

Opis:
Funkcja atol() zwraca wartość przekonwertowaną z łańcucha znaków do postaci liczbowej (typ long int) w przypadku sukcesu. Funkcja atol() zwraca wartość zero w przypadku gdy nie jest możliwe dokonanie konwersji łańcucha znaków przekazanego jako argument funkcji.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.

Zwracana wartość:
long int - Postać liczbowa (typ long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku atol.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	long int longval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s <longintvalue>\n", argv[0]);
		printf("Examples:\n");
		printf("         %s 123\n", argv[0]);
		printf("         %s 123.456\n", argv[0]);
		printf("         %s 123.456a\n", argv[0]);
		printf("         %s 123.a456\n", argv[0]);
		printf("         %s 123a.456\n", argv[0]);
		printf("         %s a123.456\n", argv[0]);
		printf("         %s +123.456\n", argv[0]);
		printf("         %s ++123.456\n", argv[0]);
		printf("         %s -123.456\n", argv[0]);
		printf("         %s --123.456\n", argv[0]);
		return 0;
	}
	
	longval=atol(argv[1]);
	printf("%s: longval=atol(argv[1]=%s): longval=%ld\n", self, argv[1], longval);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/atol
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/varhandle/atol <longintvalue>
Examples:
         /home/local/code/ansiccode/varhandle/atol 123
         /home/local/code/ansiccode/varhandle/atol 123.456
         /home/local/code/ansiccode/varhandle/atol 123.456a
         /home/local/code/ansiccode/varhandle/atol 123.a456
         /home/local/code/ansiccode/varhandle/atol 123a.456
         /home/local/code/ansiccode/varhandle/atol a123.456
         /home/local/code/ansiccode/varhandle/atol +123.456
         /home/local/code/ansiccode/varhandle/atol ++123.456
         /home/local/code/ansiccode/varhandle/atol -123.456
         /home/local/code/ansiccode/varhandle/atol --123.456

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/atol 123
/home/local/code/ansiccode/varhandle/atol 123.456
/home/local/code/ansiccode/varhandle/atol 123.456a
/home/local/code/ansiccode/varhandle/atol 123.45a6
/home/local/code/ansiccode/varhandle/atol 123.4a56
/home/local/code/ansiccode/varhandle/atol 123.a456
/home/local/code/ansiccode/varhandle/atol 123a.456
/home/local/code/ansiccode/varhandle/atol 12a3.456
/home/local/code/ansiccode/varhandle/atol 1a23.456
/home/local/code/ansiccode/varhandle/atol a123.456
/home/local/code/ansiccode/varhandle/atol +123.456
/home/local/code/ansiccode/varhandle/atol ++123.456
/home/local/code/ansiccode/varhandle/atol -123.456
/home/local/code/ansiccode/varhandle/atol --123.456
rezultat będzie zależny od podanych argumentów wywołania programu:
atol: longval=atol(argv[1]=123): longval=123

atol: longval=atol(argv[1]=123.456): longval=123

atol: longval=atol(argv[1]=123.456a): longval=123

atol: longval=atol(argv[1]=123.45a6): longval=123

atol: longval=atol(argv[1]=123.4a56): longval=123

atol: longval=atol(argv[1]=123.a456): longval=123

atol: longval=atol(argv[1]=123a.456): longval=123

atol: longval=atol(argv[1]=12a3.456): longval=12

atol: longval=atol(argv[1]=1a23.456): longval=1

atol: longval=atol(argv[1]=a123.456): longval=0

atol: longval=atol(argv[1]=+123.456): longval=123

atol: longval=atol(argv[1]=++123.456): longval=0

atol: longval=atol(argv[1]=-123.456): longval=-123

atol: longval=atol(argv[1]=--123.456): longval=0



#top atoll


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji atoll() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji atoll() jest następująca:
/* Convert a string to a long long integer.  */
__extension__ extern long long int atoll (__const char *__nptr)
     __THROW __attribute_pure__ __nonnull ((1)) __wur;

Powiązane:
atof(), atoi(), atol(), atoll(),

Opis:
Funkcja atoll() zwraca wartość przekonwertowaną z łańcucha znaków do postaci liczbowej (typ long long int) w przypadku sukcesu. Funkcja atoll() zwraca wartość zero w przypadku gdy nie jest możliwe dokonanie konwersji łańcucha znaków przekazanego jako argument funkcji.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.

Zwracana wartość:
long long int - Postać liczbowa (typ long long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku atoll.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */



int main(int argc, char **argv) {
	char *self;
	long long int longlongval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s <longlongintvalue>\n", argv[0]);
		printf("Examples:\n");
		printf("         %s 123\n", argv[0]);
		printf("         %s 123.456\n", argv[0]);
		printf("         %s 123.456a\n", argv[0]);
		printf("         %s 123.a456\n", argv[0]);
		printf("         %s 123a.456\n", argv[0]);
		printf("         %s a123.456\n", argv[0]);
		printf("         %s +123.456\n", argv[0]);
		printf("         %s ++123.456\n", argv[0]);
		printf("         %s -123.456\n", argv[0]);
		printf("         %s --123.456\n", argv[0]);
		return 0;
	}
	
	longlongval=atoll(argv[1]);
	printf("%s: longlongval=atoll(argv[1]=%s): longlongval=%lld\n", self, argv[1], longlongval);
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/atoll
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/varhandle/atoll <longlongintvalue>
Examples:
         /home/local/code/ansiccode/varhandle/atoll 123
         /home/local/code/ansiccode/varhandle/atoll 123.456
         /home/local/code/ansiccode/varhandle/atoll 123.456a
         /home/local/code/ansiccode/varhandle/atoll 123.a456
         /home/local/code/ansiccode/varhandle/atoll 123a.456
         /home/local/code/ansiccode/varhandle/atoll a123.456
         /home/local/code/ansiccode/varhandle/atoll +123.456
         /home/local/code/ansiccode/varhandle/atoll ++123.456
         /home/local/code/ansiccode/varhandle/atoll -123.456
         /home/local/code/ansiccode/varhandle/atoll --123.456

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/atoll 123
/home/local/code/ansiccode/varhandle/atoll 123.456
/home/local/code/ansiccode/varhandle/atoll 123.456a
/home/local/code/ansiccode/varhandle/atoll 123.45a6
/home/local/code/ansiccode/varhandle/atoll 123.4a56
/home/local/code/ansiccode/varhandle/atoll 123.a456
/home/local/code/ansiccode/varhandle/atoll 123a.456
/home/local/code/ansiccode/varhandle/atoll 12a3.456
/home/local/code/ansiccode/varhandle/atoll 1a23.456
/home/local/code/ansiccode/varhandle/atoll a123.456
/home/local/code/ansiccode/varhandle/atoll +123.456
/home/local/code/ansiccode/varhandle/atoll ++123.456
/home/local/code/ansiccode/varhandle/atoll -123.456
/home/local/code/ansiccode/varhandle/atoll --123.456
rezultat będzie zależny od podanych argumentów wywołania programu:
atoll: longlongval=atoll(argv[1]=123): longlongval=123

atoll: longlongval=atoll(argv[1]=123.456): longlongval=123

atoll: longlongval=atoll(argv[1]=123.456a): longlongval=123

atoll: longlongval=atoll(argv[1]=123.45a6): longlongval=123

atoll: longlongval=atoll(argv[1]=123.4a56): longlongval=123

atoll: longlongval=atoll(argv[1]=123.a456): longlongval=123

atoll: longlongval=atoll(argv[1]=123a.456): longlongval=123

atoll: longlongval=atoll(argv[1]=12a3.456): longlongval=12

atoll: longlongval=atoll(argv[1]=1a23.456): longlongval=1

atoll: longlongval=atoll(argv[1]=a123.456): longlongval=0

atoll: longlongval=atoll(argv[1]=+123.456): longlongval=123

atoll: longlongval=atoll(argv[1]=++123.456): longlongval=0

atoll: longlongval=atoll(argv[1]=-123.456): longlongval=-123

atoll: longlongval=atoll(argv[1]=--123.456): longlongval=0



#top strtod


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtod() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtod() jest następująca:
/* Convert a string to a floating-point number.  */
extern double strtod (__const char *__restrict __nptr,
              char **__restrict __endptr)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtod(), strtof(), strtold(),

Opis:
Funkcja strtod() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu double) w przypadku sukcesu. Funkcja strtod() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie double. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtod() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
double - Postać liczbowa (typ double) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtod.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
	double doubleval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:   %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100.00 AAA 200.00 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
	while (*start) {
		doubleval=strtod(start, &end);
		printf("%s: doubleval=strtod(start=|%s|, &end=|%s|): doubleval=%f\n", self, start, end, doubleval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtod
program wyświetli informacje o sposobie uruchamiania programu:
Usage:   /home/local/code/ansiccode/varhandle/strtod <args>
Examples:
         /home/local/code/ansiccode/varhandle/strtod "100.00 AAA 200.00 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtod "100.00 AAA 200.00 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtod: start=100.00 AAA 200.00 BBBB
strtod: doubleval=strtod(start=|100.00 AAA 200.00 BBBB|, &end=| AAA 200.00 BBBB|): doubleval=100.000000
strtod: doubleval=strtod(start=|200.00 BBBB|, &end=| BBBB|): doubleval=200.000000



#top strtof


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtof() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtof() jest następująca:
/* Likewise for `float' and `long double' sizes of floating-point numbers.  */
extern float strtof (__const char *__restrict __nptr,
             char **__restrict __endptr) __THROW __nonnull ((1)) __wur;

Powiązane:
strtod(), strtof(), strtold(),

Opis:
Funkcja strtof() zwraca przekonwertowaną wartość z łańcucha znaków do postaci liczbowej (typu float) w przypadku sukcesu. Funkcja strtof() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie float. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtof() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
float - Postać liczbowa (typ float) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtof.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
#if defined(HAVE_STRTOF)
	float floatval;
#endif /*defined(HAVE_STRTOF)*/
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage:  %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100.00 AAA 200.00 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
	
#if defined(HAVE_STRTOF)
	while (*start) {
		floatval=strtof(start, &end);
		printf("%s: floatval=strtof(start=|%s|, &end=|%s|): floatval=%f\n", self, start, end, floatval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
#else
	/* strtof() is not available on this OS platform !!! */
	printf("%s: strtof() is not available on this OS platform !!!\n", argv[0]);
#endif /*defined(HAVE_STRTOF)*/
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtof
program wyświetli informacje o sposobie uruchamiania programu:
Usage:  /home/local/code/ansiccode/varhandle/strtof
Examples:
         /home/local/code/ansiccode/varhandle/strtof "100.00 AAA 200.00 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtof "100.00 AAA 200.00 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtof: start=100.00 AAA 200.00 BBBB
strtof: floatval=strtof(start=|100.00 AAA 200.00 BBBB|, &end=| AAA 200.00 BBBB|): floatval=100.000000
strtof: floatval=strtof(start=|200.00 BBBB|, &end=| BBBB|): floatval=200.000000



#top strtol


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtol() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtol() jest następująca:
/* Convert a string to a long integer.  */
extern long int strtol (__const char *__restrict __nptr,
            char **__restrict __endptr, int __base)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtol(), strtoll(), strtoq(), strtoul(), strtoull(), strtouq(),

Opis:
Funkcja strtol() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu long int) w przypadku sukcesu. Funkcja strtol() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie long int. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtol() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
long int - Postać liczbowa (typ long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtol.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
	long int longintval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100 AAA 200 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
	while (*start) {
		longintval=strtol(start, &end, 0);
		printf("%s: longintval=strtol(start=|%s|, &end=|%s|, 0): longintval=%ld\n", self, start, end, longintval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtol
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/varhandle/strtol
Examples:
         /home/local/code/ansiccode/varhandle/strtol "100 AAA 200 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtol "100 AAA 200 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtof: start=100.00 AAA 200.00 BBBB
strtof: floatval=strtof(start=|100.00 AAA 200.00 BBBB|, &end=| AAA 200.00 BBBB|): floatval=100.000000
strtof: floatval=strtof(start=|200.00 BBBB|, &end=| BBBB|): floatval=200.000000



#top strtold


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtold() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtold() jest następująca:
/* Convert a string to a long integer.  */
extern long double strtold (__const char *__restrict __nptr,
                char **__restrict __endptr)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtod(), strtof(), strtold(),

Opis:
Funkcja strtold() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu long double) w przypadku sukcesu. Funkcja strtold() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie long double. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtold() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
long double - Postać liczbowa (typ long double) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtold.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
#if defined(HAVE_STRTOLD)
	long double longdoubleval;
#endif /*defined(HAVE_STRTOLD)*/
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100.00 AAA 200.00 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
	
#if defined(HAVE_STRTOLD)
	while (*start) {
		longdoubleval=strtold(start, &end);
		printf("%s: longdoubleval=strtold(start=|%s|, &end=|%s|): longdoubleval=%Le\n", self, start, end, longdoubleval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
#else
	/* strtold() is not available on this OS platform !!! */
	printf("%s: strtold() is not available on this OS platform !!!\n", argv[0]);
#endif /*defined(HAVE_STRTOLD)*/
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtold
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/varhandle/strtold
Examples:
         /home/local/code/ansiccode/varhandle/strtold "100.00 AAA 200.00 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtold "100.00 AAA 200.00 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtold: start=100.00 AAA 200.00 BBBB
strtold: longdoubleval=strtold(start=|100.00 AAA 200.00 BBBB|, &end=| AAA 200.00 BBBB|): longdoubleval=1.000000e+02
strtold: longdoubleval=strtold(start=|200.00 BBBB|, &end=| BBBB|): longdoubleval=2.000000e+02



#top strtoll


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtoll() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtoll() jest następująca:
/* Convert a string to a quadword integer.  */
extern long long int strtoll (__const char *__restrict __nptr,
                  char **__restrict __endptr, int __base)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtol(), strtoll(), strtoq(), strtoul(), strtoull(), strtouq(),

Opis:
Funkcja strtoll() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu long long int) w przypadku sukcesu. Funkcja strtoll() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie long long int. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtoll() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
long long int - Postać liczbowa (typ long long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtoll.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
	long long int longlongintval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100 AAA 200 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
	while (*start) {
		longlongintval=strtoll(start, &end, 0);
		printf("%s: longlongintval=strtoll(start=|%s|, &end=|%s|, 0): longlongintval=%lld\n", self, start, end, longlongintval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtoll
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/varhandle/strtoll
Examples:
         /home/local/code/ansiccode/varhandle/strtoll "100 AAA 200 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtoll "100 AAA 200 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtold: start=100.00 AAA 200.00 BBBB
strtold: longdoubleval=strtold(start=|100.00 AAA 200.00 BBBB|, &end=| AAA 200.00 BBBB|): longdoubleval=1.000000e+02
strtold: longdoubleval=strtold(start=|200.00 BBBB|, &end=| BBBB|): longdoubleval=2.000000e+02



#top strtoq


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtoq() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtoq() jest następująca:
/* Convert a string to a quadword integer.  */
extern long long int strtoq (__const char *__restrict __nptr,
                 char **__restrict __endptr, int __base)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtol(), strtoll(), strtoq(), strtoul(), strtoull(), strtouq(),

Opis:
Funkcja strtoq() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu long long int) w przypadku sukcesu. Funkcja strtoq() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie long long int. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtoq() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
long long int - Postać liczbowa (typ long long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtoq.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
#if defined(HAVE_STRTOQ)
	long long int longlongintval;
#endif /*defined(HAVE_STRTOQ)*/
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100 AAA 200 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
#if defined(HAVE_STRTOQ)
	while (*start) {
		longlongintval=strtoq(start, &end, 0);
		printf("%s: longlongintval=strtoq(start=|%s|, &end=|%s|, 0): longlongintval=%lld\n", self, start, end, longlongintval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
#else
	/* strtoq() is not available on this OS platform !!! */
	printf("%s: strtoq() is not available on this OS platform !!!\n", argv[0]);
#endif /*defined(HAVE_STRTOQ)*/
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtoq
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/varhandle/strtoq
Examples:
         /home/local/code/ansiccode/varhandle/strtoq "100 AAA 200 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtoq "100 AAA 200 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtoq: start=100 AAA 200 BBBB
strtoq: longlongintval=strtoq(start=|100 AAA 200 BBBB|, &end=| AAA 200 BBBB|, 0): longlongintval=100
strtoq: longlongintval=strtoq(start=|200 BBBB|, &end=| BBBB|, 0): longlongintval=200



#top strtoul


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtoul() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtoul() jest następująca:
/* Convert a string to an unsigned long integer.  */
extern unsigned long int strtoul (__const char *__restrict __nptr,
                  char **__restrict __endptr, int __base)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtol(), strtoll(), strtoq(), strtoul(), strtoull(), strtouq(),

Opis:
Funkcja strtoul() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu unsigned long int) w przypadku sukcesu. Funkcja strtoul() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie unsigned long int. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtoul() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
unsigned long int - Postać liczbowa (typ unsigned long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtoul.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
	unsigned long int ulongintval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100 AAA 200 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
	while (*start) {
		ulongintval=strtoul(start, &end, 0);
		printf("%s: ulongintval=strtoul(start=|%s|, &end=|%s|, 0): ulongintval=%lu\n", self, start, end, ulongintval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtoul
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/varhandle/strtoul "<string>"
Examples:
         /home/local/code/ansiccode/varhandle/strtoul "100 AAA 200 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtoul "100 AAA 200 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtoul: start=100 AAA 200 BBBB
strtoul: ulongintval=strtoul(start=|100 AAA 200 BBBB|, &end=| AAA 200 BBBB|, 0): ulongintval=100
strtoul: ulongintval=strtoul(start=|200 BBBB|, &end=| BBBB|, 0): ulongintval=200



#top strtoull


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtoull() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtoull() jest następująca:
/* Convert a string to an unsigned quadword integer.  */
extern unsigned long long int strtoull (__const char *__restrict __nptr,
                    char **__restrict __endptr, int __base)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtol(), strtoll(), strtoq(), strtoul(), strtoull(), strtouq(),

Opis:
Funkcja strtoull() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu unsigned long long int) w przypadku sukcesu. Funkcja strtoull() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie unsigned long long int. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtoull() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
unsigned long long int - Postać liczbowa (typ unsigned long long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtoull.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
	unsigned long long int ulonglongintval;
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100 AAA 200 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
	while (*start) {
		ulonglongintval=strtoull(start, &end, 0);
		printf("%s: ulonglongintval=strtoull(start=|%s| &end=|%s|, 0): ulonglongintval=%llu\n", self, start, end, ulonglongintval);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtoull
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/varhandle/strtoull "<string>"
Examples:
         /home/local/code/ansiccode/varhandle/strtoull "100 AAA 200 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtoull "100 AAA 200 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtoull: start=100 AAA 200 BBBB
strtoull: ulonglongintval=strtoull(start=|100 AAA 200 BBBB| &end=| AAA 200 BBBB|, 0): ulonglongintval=100
strtoull: ulonglongintval=strtoull(start=|200 BBBB| &end=| BBBB|, 0): ulonglongintval=200



#top strtouq


Documentacja online: pubs.opengroup.org | www.cplusplus.com | pl.wikibooks.org

Deklaracja funkcji strtouq() znajduje się w pliku nagłówkowym stdlib.h.
Deklaracja funkcji strtouq() jest następująca:
/* Convert a string to an unsigned quadword integer.  */
extern unsigned long long int strtouq (__const char *__restrict __nptr,
                       char **__restrict __endptr, int __base)
     __THROW __nonnull ((1)) __wur;

Powiązane:
strtol(), strtoll(), strtoq(), strtoul(), strtoull(), strtouq(),

Opis:
Funkcja strtouq() zwraca zwraca wartość przekonwertowaną wartość z łancucha znaków do postaci liczbowej (typu unsigned long long int) w przypadku sukcesu. Funkcja strtouq() zwraca wartość HUGE_VAL lub -HUGE_VAL jeżeli wartość jest zbyt duża by reprezentacja wartości zmieściła się w typie unsigned long long int. Znak +/- jest zależny od wartości konwertowanej. Funkcja strtouq() zwraca wartość 0 jeżeli konwersja nie może zostać przeprowadzona lub wystąpi niedomiar.

Argumenty:
const char *__nptr - Łańcuch znaków, który ma zostać przekonwertowany do postaci liczbowej.
const char **__endptr - Zwraca adres znaku na którym została zakończona konwersja liczby konwertowanej. W przypadku gdy wartość argumentu będzie wynosić NULL to adres znaku nie zostanie zwrócony.

Zwracana wartość:
unsigned long long int - Postać liczbowa (typ unsigned long long int) przekonwertowana z łańcucha znaków.

Example:
zawartość pliku strtouq.c
SELECT ALL
#define  _GNU_SOURCE  1    /* for environ defined in unistd.h, to avoid warning implicit declaration of function basename, which defined in string.h */
#include <stdio.h>         /* for FILE, va_list, EOF, SEEK_SET, SEEK_CUR, SEEK_END, stdin, stdout, stderr, remove(), rename(), tmpfile(), tmpnam(), tempnam(), fclose(), */
                           /* fflush(), fopen(), freopen(), fprintf(), printf(), snprintf(), scanf(), sscanf(), fgetc(), getc(), getchar(), fputc(), putc(), putchar(), */
                           /* fgets(), gets(), fputs(), puts(), fread(), fwrite(), fseek(), ftell(), rewind(), feof(), ferror(), fileno(), popen(), pclose(), */
#include <stdlib.h>        /* for RAND_MAX, EXIT_FAILURE, EXIT_SUCCESS, MB_CUR_MAX, atoi(), atol(), atoll(), atof(), strtod(), strtof(), strtold(), strtol(), strtoul(), strtoq(), strtouq(), strtoll(), strtoull(), */
                           /* for sys/types.h, malloc.h replaced by stdlib.h, random(), srandom(), rand(), srand(), abort(), atexit(), on_exit(), exit(), getenv(), */
                           /* for putenv(), setenv(), clearenv(), mktemp(), mkdtemp(), system(), realpath(), abs(), llabs(), getloadavg() */
#include <string.h>        /* for memcpy(), memmove(), memset(), memcmp(), memchr(), memrchr(), str[n]cpy(), str[n]cat(), str[n]cmp(), strcoll(), str[n]dup(), strchr(), strrchr(), strstr(), */
                           /* strtok(), strcasestr(), memmem(), mempcpy(), str[n]len(), strerror(), bcopy(), bzero(), strcasecmp(), strsep(), basename(), */
#include <ctype.h>         /* for tolower(), toupper(), isctype(), isascii(), toascii(), isalnum(), isalpha(), iscntrl(), isdigit(), islower(), isgraph(), isprint(), ispunct(), isspace(), isupper(), isxdigit(), */



int main(int argc, char **argv) {
	char *self;
	char *end, *start;
#if defined(HAVE_STRTOUQ)
	unsigned long long int ulonglongintval;
#endif /*defined(HAVE_STRTOUQ)*/
	
	self=strrchr(argv[0], '/');
	if (self!=NULL) self++;
	else self=argv[0];
	
	if (argc<2) {
		printf("Usage: %s \"<string>\"\n", argv[0]);
		printf("Examples:\n");
		printf("         %s \"100 AAA 200 BBBB\"\n", argv[0]);
		return 0;
	}
	
	start=argv[1];
	printf("%s: start=%s\n", self, start);
	end = start;
#if defined(HAVE_STRTOUQ)
	while (*start) {
		ulonglongintval=strtouq(start, &end, 0);
		printf("%s: ulonglongintval=%llu start=|%s| end=|%s|\n", self, ulonglongintval, start, end);
		start = end;
		/* move past the non-digits */
		while (!isdigit(*start) && *start) start++;
	}
#else
	/* strtouq() is not available on this OS platform !!! */
	printf("%s: strtouq() is not available on this OS platform !!!\n", argv[0]);
#endif /*defined(HAVE_STRTOUQ)*/
	
	return 0;
}

program należy skompilować komendą make (jako argument należy podać plik Makefile zależny od systemu operacyjnego, domyślnie make próbuje użyć pliku Makefile):
make clean all # system Linux
make -f Makefile clean all # system Linux
make -f Makefile.obsd clean all # system OpenBSD
make -f Makefile.fbsd clean all # system FreeBSD
make -f Makefile.sol clean all # system Solaris
make -f Makefile.beos clean all # system BeOS
make -f Makefile.win clean all # system Windows

a następnie uruchomić bez argumentów:
/home/local/code/ansiccode/varhandle/strtouq
program wyświetli informacje o sposobie uruchamiania programu:
Usage: /home/local/code/ansiccode/varhandle/strtouq
Examples:
         /home/local/code/ansiccode/varhandle/strtouq "100 AAA 200 BBBB"

jako argument wywołania programu można podać analogiczne jak poniżej argumenty:
/home/local/code/ansiccode/varhandle/strtouq "100 AAA 200 BBBB"
rezultat będzie zależny od podanych argumentów wywołania programu:
strtouq: start=100 AAA 200 BBBB
strtouq: ulonglongintval=100 start=|100 AAA 200 BBBB| end=| AAA 200 BBBB|
strtouq: ulonglongintval=200 start=|200 BBBB| end=| BBBB|





Zmodyfikowany ostatnio: 2014/03/04 09:48:05 (10 lat temu), textsize: 102 kB, htmlsize: 148 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników