¿Que es Instagram?
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes Menú
#include<winsock2.h>
#include<stdio.h>
int main() {
int s;
if ((s = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
printf("Valor %i\n",s);
perror("socket");
return 1;
}
}
C:\> gcc -o test.exe test.c -lws2_32
C:\> test.exe
Valor -1
socket: No error
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --target=mingw32 --with-gmp=/mingw --with-mpfr --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --with-arch=i586 --with-tune=generic --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)
Citarelaborate in structure or decoration. "the furniture was very fancy"
Citar
main.c:87:26: warning: passing argument 2 of ganador1 makes pointer from integer without a cast [-Wint-conversion]
ganador=ganador1(ganador,tablero1[j]);
^
main.c:4:9: note: expected int (*)[7] but argument is of type int
int ganador1(int n,int tablero[6][7]);
tablero1[i][j]
ganador=ganador1(ganador,tablero1);
Citarprinft("El jugador 1 es el que gana");
Citarmain.c:136:30: warning: passing argument 2 of ganador2 makes pointer from integer without a cast [-Wint-conversion]
validacion2=ganador2(ganador,tablero1[j]);
^
main.c:5:9: note: expected int (*)[7] but argument is of type int
int ganador2(int n,int tablero[6][7]);
^
Citarsystem("cls");
Citar
^
main.c:18:1: warning: ignoring return value of scanf, declared with attribute warn_unused_result [-Wunused-result]
scanf("%i",&opciones);
^
main.c:23:5: warning: ignoring return value of system, declared with attribute warn_unused_result [-Wunused-result]
system("cls");
^
main.c:54:1: warning: ignoring return value of scanf, declared with attribute warn_unused_result [-Wunused-result]
scanf("%i",&jugador1);
^
main.c:93:1: warning: ignoring return value of system, declared with attribute warn_unused_result [-Wunused-result]
system("cls");
^
main.c:103:1: warning: ignoring return value of scanf, declared with attribute warn_unused_result [-Wunused-result]
scanf("%i",&jugador2);
^
main.c:142:1: warning: ignoring return value of system, declared with attribute warn_unused_result [-Wunused-result]
system("cls");
^
main.c:155:1: warning: ignoring return value of scanf, declared with attribute warn_unused_result [-Wunused-result]
scanf("%i",&volverajugar);
^
/var/tmp/ccOyAiBU.o: In function `main':
main.c:(.text.startup+0xb0): undefined reference to `prinft'
main.c:(.text.startup+0x503): undefined reference to `prinft'
collect2: error: ld returned 1 exit status
C:\codigos>g++ -o t.exe t.cpp
t.cpp: In function 'int main()':
t.cpp:12:21: error: 'time' was not declared in this scope
srand(time(NULL));
C:\codigos>g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/6.3.0/lto-wrapper.exe
Target: mingw32
Configured with: ../src/gcc-6.3.0/configure --build=x86_64-pc-linux-gnu --host=mingw32 --with-gmp=/mingw --with-mpfr=/mingw --with-mpc=/mingw --with-isl=/mingw --prefix=/mingw --disable-win32-registry --target=mingw32 --with-arch=i586 --enable-languages=c,c++,objc,obj-c++,fortran,ada --with-pkgversion='MinGW.org GCC-6.3.0-1' --enable-static --enable-shared --enable-threads --with-dwarf2 --disable-sjlj-exceptions --enable-version-specific-runtime-libs --with-libiconv-prefix=/mingw --with-libintl-prefix=/mingw --enable-libstdcxx-debug --with-tune=generic --enable-libgomp --disable-libvtv --enable-nls
Thread model: win32
gcc version 6.3.0 (MinGW.org GCC-6.3.0-1)
Cita de: MAFUS en 24 Noviembre 2018, 22:34 PM
A raíz de este post me he puesto a pensar en todo esto.
Ya que C viene del UNIX y en UNIX todo son archivos y por tanto stdin es un archivo ¿qué tal si llevamos el puntero de stdin hasta el final y nos saltamos todo lo que hay dentro?
Incluso acepta una única pulsación de intro.
#include<stdio.h>
int main() {
char temporal[10];
printf("Ingrese una cadena: ");
fgets(temporal,10,stdin);
printf("Cadena Leida: %s\n",temporal);
fseek(stdin, 0, SEEK_END);
printf("Ingrese otra cadena: ");
fgets(temporal,10,stdin);
printf("Cadena Leida: %s\n",temporal);
}
#include<stdio.h>
#include<string.h>
int main() {
int len,i = 0;
char temporal[10];
char c;
printf("Ingrese una cadena: ");
fgets(temporal,10,stdin);
printf("Cadena Leida: %s\n",temporal);
len = strlen(temporal);
if(temporal[len - 1 ] != 0xA) {
while ((c = getchar()) != 0xA);
}
printf("Ingrese otra cadena: ");
fgets(temporal,10,stdin);
printf("Cadena Leida: %s\n",temporal);
}