elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: (TUTORIAL) Aprende a emular Sentinel Dongle By Yapis


  Mostrar Mensajes
Páginas: 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21] 22
201  Programación / Programación C/C++ / Re: SQLite3 Amalgamation y C: Visor de Archivos y URLs al Azar en: 15 Abril 2016, 14:57 pm
@MAFUS:  me sirvió mucho la explicación  ;-)

Me la pasaba haciendo castings y supuestamente estaba jugando en C y ahora SI pude compilar sin errores el archivo, muchas gracias, me has salvado otra vez!

202  Programación / Programación C/C++ / Re: SQLite3 Amalgamation y C: Visor de Archivos y URLs al Azar en: 15 Abril 2016, 02:01 am
Bueno, lo he probado y no me ha funcionado  :-\

Código
  1. g++ -o SQLite3-Amalgamation_example SQLite3-Amalgamation_example.c
  2.  

Me genera todo este choclo de errores:

Citar
In file included from SQLite3-Amalgamation_example.c:5:0:

c:\mingw\include\sqlite3.c: In function 'void strftimeFunc(sqlite3_context*, int, sqlite3_value**)':
c:\mingw\include\sqlite3.c:17689:40: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
     z = sqlite3DbMallocRawNN(db, (int)n);
                                        ^
c:\mingw\include\sqlite3.c: In function 'void* sqlite3MemMalloc(int)':
c:\mingw\include\sqlite3.c:18592:7: error: invalid conversion from 'void*' to 'sqlite3_int64* {aka long long int*}' [-
ermissive]
   p = SQLITE_MALLOC( nByte+8 );
       ^
c:\mingw\include\sqlite3.c: In function 'void* sqlite3MemRealloc(void*, int)':
c:\mingw\include\sqlite3.c:18665:7: error: invalid conversion from 'void*' to 'sqlite3_int64* {aka long long int*}' [-
ermissive]
   p = SQLITE_REALLOC(p, nByte+8 );
       ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c: In function 'sqlite3_mutex* winMutexAlloc(int)':
c:\mingw\include\sqlite3.c:21842:41: error: invalid conversion from 'void*' to 'sqlite3_mutex*' [-fpermissive]
       p = sqlite3MallocZero( sizeof(*p) );
                                         ^
c:\mingw\include\sqlite3.c: In function 'char* sqlite3DbStrDup(sqlite3*, const char*)':
c:\mingw\include\sqlite3.c:22757:39: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   zNew = sqlite3DbMallocRaw(db, (int)n);
                                       ^
c:\mingw\include\sqlite3.c: In function 'char* sqlite3DbStrNDup(sqlite3*, const char*, u64)':
c:\mingw\include\sqlite3.c:22770:38: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   zNew = sqlite3DbMallocRawNN(db, n+1);
                                      ^
c:\mingw\include\sqlite3.c: In function 'void sqlite3VXPrintf(StrAccum*, const char*, va_list)':
c:\mingw\include\sqlite3.c:23266:47: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
           zOut = zExtra = sqlite3Malloc( nOut );
                                               ^
c:\mingw\include\sqlite3.c:23377:71: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
               = sqlite3Malloc( MAX(e2,0)+(i64)precision+(i64)width+15 );
                                                                       ^
c:\mingw\include\sqlite3.c:23525:29: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]
         if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
                             ^
c:\mingw\include\sqlite3.c:23533:45: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
           bufpt = zExtra = sqlite3Malloc( n );
                                             ^
c:\mingw\include\sqlite3.c:23568:48: error: cannot convert 'SrcList::SrcList_item*' to 'SrcList_item*' in initializati

         struct SrcList_item *pItem = &pSrc->a[k];
                                                ^
c:\mingw\include\sqlite3.c:23571:18: error: invalid use of incomplete type 'struct SrcList_item'
         if( pItem->zDatabase ){
                  ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c:14473:59: error: forward declaration of 'struct SrcList_item'
 SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);
                                                           ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c:23572:49: error: invalid use of incomplete type 'struct SrcList_item'
           sqlite3StrAccumAppendAll(pAccum, pItem->zDatabase);
                                                 ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c:14473:59: error: forward declaration of 'struct SrcList_item'
 SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);
                                                           ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c:23575:47: error: invalid use of incomplete type 'struct SrcList_item'
         sqlite3StrAccumAppendAll(pAccum, pItem->zName);
                                               ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c:14473:59: error: forward declaration of 'struct SrcList_item'
 SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *);
                                                           ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c: In function 'int sqlite3StrAccumEnlarge(StrAccum*, int)':
c:\mingw\include\sqlite3.c:23638:53: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
       zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc);
                                                     ^
c:\mingw\include\sqlite3.c:23640:47: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
       zNew = sqlite3_realloc64(zOld, p->nAlloc);
                                               ^
c:\mingw\include\sqlite3.c: In function 'char* sqlite3StrAccumFinish(StrAccum*)':
c:\mingw\include\sqlite3.c:23722:55: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
       p->zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );
                                                       ^
c:\mingw\include\sqlite3.c: In function 'void sqlite3_randomness(int, void*)':
c:\mingw\include\sqlite3.c:24479:25: error: invalid conversion from 'void*' to 'unsigned char*' [-fpermissive]
   unsigned char *zBuf = pBuf;
                         ^
c:\mingw\include\sqlite3.c: In function 'int sqlite3ThreadCreate(SQLiteThread**, void* (*)(void*), void*)':
c:\mingw\include\sqlite3.c:24737:31: error: invalid conversion from 'void*' to 'SQLiteThread*' [-fpermissive]
   p = sqlite3Malloc(sizeof(*p));
                               ^
c:\mingw\include\sqlite3.c: In function 'int sqlite3VdbeMemTranslate(Mem*, u8)':
c:\mingw\include\sqlite3.c:25132:42: error: invalid conversion from 'void*' to 'unsigned char*' [-fpermissive]
   zOut = sqlite3DbMallocRaw(pMem->db, len);
                                          ^
c:\mingw\include\sqlite3.c: In function 'char* sqlite3Utf16to8(sqlite3*, const void*, int, u8)':
c:\mingw\include\sqlite3.c:25299:56: error: invalid conversion from 'const void*' to 'const char*' [-fpermissive]
   sqlite3VdbeMemSetStr(&m, z, nByte, enc, SQLITE_STATIC);
                                                        ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c:16306:20: note: initializing argument 2 of 'int sqlite3VdbeMemSetStr(Mem*, const char*, int
u8, void (*)(void*))'
 SQLITE_PRIVATE int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*));
                    ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c: In function 'int sqlite3Utf16ByteLen(const void*, int)':
c:\mingw\include\sqlite3.c:25318:28: error: invalid conversion from 'const void*' to 'const unsigned char*' [-fpermiss
e]
   unsigned char const *z = zIn;
                            ^
c:\mingw\include\sqlite3.c: In function 'void insertElement(Hash*, _ht*, HashElem*)':
c:\mingw\include\sqlite3.c:26935:19: error: invalid use of incomplete type 'struct _ht'
     pHead = pEntry->count ? pEntry->chain : 0;
                   ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c:26935:35: error: invalid use of incomplete type 'struct _ht'
     pHead = pEntry->count ? pEntry->chain : 0;
                                   ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c:26936:11: error: invalid use of incomplete type 'struct _ht'
     pEntry->count++;
           ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c:26937:11: error: invalid use of incomplete type 'struct _ht'
     pEntry->chain = pNew;
           ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c: In function 'int rehash(Hash*, unsigned int)':
c:\mingw\include\sqlite3.c:26967:33: error: invalid application of 'sizeof' to incomplete type '_ht'
   if( new_size*sizeof(struct _ht)>SQLITE_MALLOC_SOFT_LIMIT ){
                                 ^
c:\mingw\include\sqlite3.c:26968:58: error: invalid application of 'sizeof' to incomplete type '_ht'
     new_size = SQLITE_MALLOC_SOFT_LIMIT/sizeof(struct _ht);
                                                          ^
c:\mingw\include\sqlite3.c:26982:67: error: invalid application of 'sizeof' to incomplete type '_ht'
   new_ht = (struct _ht *)sqlite3Malloc( new_size*sizeof(struct _ht) );
                                                                   ^
c:\mingw\include\sqlite3.c:26987:10: error: cannot convert '_ht*' to 'Hash::_ht*' in assignment
   pH->ht = new_ht;
          ^
c:\mingw\include\sqlite3.c:26988:70: error: invalid application of 'sizeof' to incomplete type '_ht'
   pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);
                                                                      ^
c:\mingw\include\sqlite3.c:26989:47: error: invalid application of 'sizeof' to incomplete type '_ht'
   memset(new_ht, 0, new_size*sizeof(struct _ht));
                                               ^
c:\mingw\include\sqlite3.c:26993:32: error: invalid use of incomplete type 'struct _ht'
     insertElement(pH, &new_ht[h], elem);
                                ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c: In function 'HashElem* findElementWithHash(const Hash*, const char*, unsigned int*)':
c:\mingw\include\sqlite3.c:27014:12: error: cannot convert 'Hash::_ht*' to '_ht*' in assignment
     pEntry = &pH->ht[h];
            ^
c:\mingw\include\sqlite3.c:27015:18: error: invalid use of incomplete type 'struct _ht'
     elem = pEntry->chain;
                  ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c:27016:19: error: invalid use of incomplete type 'struct _ht'
     count = pEntry->count;
                   ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c: In function 'void removeElementGivenHash(Hash*, HashElem*, unsigned int)':
c:\mingw\include\sqlite3.c:27051:12: error: cannot convert 'Hash::_ht*' to '_ht*' in assignment
     pEntry = &pH->ht[h];
            ^
c:\mingw\include\sqlite3.c:27052:15: error: invalid use of incomplete type 'struct _ht'
     if( pEntry->chain==elem ){
               ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c:27053:13: error: invalid use of incomplete type 'struct _ht'
       pEntry->chain = elem->next;
             ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c:27055:11: error: invalid use of incomplete type 'struct _ht'
     pEntry->count--;
           ^
c:\mingw\include\sqlite3.c:26930:10: error: forward declaration of 'struct _ht'
   struct _ht *pEntry,    /* The entry into which pNew is inserted */
          ^
c:\mingw\include\sqlite3.c: In function 'void* sqlite3HashInsert(Hash*, const char*, void*)':
c:\mingw\include\sqlite3.c:27125:54: error: cannot convert 'Hash::_ht*' to '_ht*' for argument '2' to 'void insertElem
t(Hash*, _ht*, HashElem*)'
   insertElement(pH, pH->ht ? &pH->ht[h] : 0, new_elem);
                                                      ^
c:\mingw\include\sqlite3.c: In function 'WCHAR* winUtf8ToUnicode(const char*)':
c:\mingw\include\sqlite3.c:36937:69: error: invalid conversion from 'void*' to 'LPWSTR {aka wchar_t*}' [-fpermissive]
   zWideFilename = sqlite3MallocZero( nChar*sizeof(zWideFilename[0]) );
                                                                     ^
c:\mingw\include\sqlite3.c: In function 'char* winUnicodeToUtf8(LPCWSTR)':
c:\mingw\include\sqlite3.c:36962:40: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   zFilename = sqlite3MallocZero( nByte );
                                        ^
c:\mingw\include\sqlite3.c: In function 'WCHAR* winMbcsToUnicode(const char*)':
c:\mingw\include\sqlite3.c:36992:69: error: invalid conversion from 'void*' to 'LPWSTR {aka wchar_t*}' [-fpermissive]
   zMbcsFilename = sqlite3MallocZero( nByte*sizeof(zMbcsFilename[0]) );
                                                                     ^
c:\mingw\include\sqlite3.c: In function 'char* winUnicodeToMbcs(LPCWSTR)':
c:\mingw\include\sqlite3.c:37021:40: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   zFilename = sqlite3MallocZero( nByte );
                                        ^
c:\mingw\include\sqlite3.c: In function 'int winOpenSharedMemory(winFile*)':
c:\mingw\include\sqlite3.c:38920:37: error: invalid conversion from 'void*' to 'winShm*' [-fpermissive]
   p = sqlite3MallocZero( sizeof(*p) );
                                     ^
c:\mingw\include\sqlite3.c:38923:60: error: invalid conversion from 'void*' to 'winShmNode*' [-fpermissive]
   pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 );
                                                            ^
c:\mingw\include\sqlite3.c: In function 'int winShmMap(sqlite3_file*, int, int, int, volatile void**)':
c:\mingw\include\sqlite3.c:39255:54: error: invalid use of incomplete type 'struct winShmMap(sqlite3_file*, int, int,
t, volatile void**)::ShmRegion'
         pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0])
                                                      ^
c:\mingw\include\sqlite3.c:39220:12: error: forward declaration of 'struct winShmMap(sqlite3_file*, int, int, int, vol
ile void**)::ShmRegion'
     struct ShmRegion *apNew;           /* New aRegion[] array */
            ^
c:\mingw\include\sqlite3.c:39255:55: error: invalid application of 'sizeof' to incomplete type 'winShmMap(sqlite3_file
 int, int, int, volatile void**)::ShmRegion'
         pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0])
                                                       ^
c:\mingw\include\sqlite3.c:39261:23: error: cannot convert 'winShmMap(sqlite3_file*, int, int, int, volatile void**)::
mRegion*' to 'winShmNode::ShmRegion*' in assignment
     pShmNode->aRegion = apNew;
                       ^
c:\mingw\include\sqlite3.c: In function 'int winGetTempname(sqlite3_vfs*, char**)':
c:\mingw\include\sqlite3.c:39685:34: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   zBuf = sqlite3MallocZero( nBuf );
                                  ^
c:\mingw\include\sqlite3.c:39794:62: error: invalid conversion from 'void*' to 'LPWSTR {aka wchar_t*}' [-fpermissive]
     LPWSTR zWidePath = sqlite3MallocZero( nMax*sizeof(WCHAR) );
                                                              ^
c:\mingw\include\sqlite3.c:39822:47: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
     char *zMbcsPath = sqlite3MallocZero( nMax );
                                               ^
c:\mingw\include\sqlite3.c: In function 'int winDelete(sqlite3_vfs*, const char*, int)':
c:\mingw\include\sqlite3.c:40254:45: error: invalid conversion from 'void*' to 'LPCWSTR {aka const wchar_t*}' [-fpermi
ive]
       attr = osGetFileAttributesW(zConverted);
                                             ^
c:\mingw\include\sqlite3.c:40270:36: error: invalid conversion from 'void*' to 'LPCWSTR {aka const wchar_t*}' [-fpermi
ive]
       if ( osDeleteFileW(zConverted) ){
                                    ^
c:\mingw\include\sqlite3.c:40283:45: error: invalid conversion from 'void*' to 'LPCSTR {aka const char*}' [-fpermissiv

       attr = osGetFileAttributesA(zConverted);
                                             ^
c:\mingw\include\sqlite3.c:40298:36: error: invalid conversion from 'void*' to 'LPCSTR {aka const char*}' [-fpermissiv

       if ( osDeleteFileA(zConverted) ){
                                    ^
c:\mingw\include\sqlite3.c: In function 'int winFullPathname(sqlite3_vfs*, const char*, int, char*)':
c:\mingw\include\sqlite3.c:40573:55: error: invalid conversion from 'void*' to 'LPWSTR {aka wchar_t*}' [-fpermissive]
     zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
                                                       ^
c:\mingw\include\sqlite3.c:40599:55: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
     zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) );
                                                       ^
c:\mingw\include\sqlite3.c: In function 'void (* winDlSym(sqlite3_vfs*, void*, const char*))()':
c:\mingw\include\sqlite3.c:40679:44: error: invalid conversion from 'HANDLE {aka void*}' to 'HMODULE {aka HINSTANCE__*
 [-fpermissive]
   proc = osGetProcAddressA((HANDLE)pH, zSym);
                                            ^
c:\mingw\include\sqlite3.c: In function 'void winDlClose(sqlite3_vfs*, void*)':
c:\mingw\include\sqlite3.c:40686:32: error: invalid conversion from 'HANDLE {aka void*}' to 'HMODULE {aka HINSTANCE__*
 [-fpermissive]
   osFreeLibrary((HANDLE)pHandle);
                                ^
c:\mingw\include\sqlite3.c: In function 'Bitvec* sqlite3BitvecCreate(u32)':
c:\mingw\include\sqlite3.c:41105:37: error: invalid conversion from 'void*' to 'Bitvec*' [-fpermissive]
   p = sqlite3MallocZero( sizeof(*p) );
                                     ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c: In function 'int sqlite3BitvecSet(Bitvec*, u32)':
c:\mingw\include\sqlite3.c:41200:21: error: invalid conversion from 'void*' to 'u32* {aka unsigned int*}' [-fpermissiv

     u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash));
                     ^
In file included from SQLite3-Amalgamation_example.c:5:0:
c:\mingw\include\sqlite3.c: In function 'void sqlite3BitvecClear(Bitvec*, u32, void*)':
c:\mingw\include\sqlite3.c:41243:21: error: invalid conversion from 'void*' to 'u32* {aka unsigned int*}' [-fpermissiv

     u32 *aiValues = pBuf;
                     ^
c:\mingw\include\sqlite3.c: In function 'int sqlite3BitvecBuiltinTest(int, int*)':
c:\mingw\include\sqlite3.c:41334:40: error: invalid conversion from 'void*' to 'unsigned char*' [-fpermissive]
   pV = sqlite3MallocZero( (sz+7)/8 + 1 );
                                        ^
c:\mingw\include\sqlite3.c: In function 'int pcache1InitBulk(PCache1*)':
c:\mingw\include\sqlite3.c:42379:9: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   zBulk = pCache->pBulk = sqlite3Malloc( szBulk );
         ^
c:\mingw\include\sqlite3.c: In function 'RowSet* sqlite3RowSetInit(sqlite3*, void*, unsigned int)':
c:\mingw\include\sqlite3.c:43475:5: error: invalid conversion from 'void*' to 'RowSet*' [-fpermissive]
   p = pSpace;
     ^
c:\mingw\include\sqlite3.c: In function 'RowSetEntry* rowSetEntryAlloc(RowSet*)':
c:\mingw\include\sqlite3.c:43519:53: error: invalid conversion from 'void*' to 'RowSetChunk*' [-fpermissive]
     pNew = sqlite3DbMallocRawNN(p->db, sizeof(*pNew));
                                                     ^
c:\mingw\include\sqlite3.c: In function 'int pager_delmaster(Pager*, const char*)':
c:\mingw\include\sqlite3.c:46467:65: error: invalid conversion from 'void*' to 'char*' [-fpermissive]
   zMasterJournal = sqlite3Malloc(nMasterJournal + nMasterPtr + 1);
                                                                 ^
c:\mingw\include\sqlite3.c: In function 'int readDbPage(PgHdr*, u32)':
c:\mingw\include\sqlite3.c:46908:68: error: invalid conversion from 'void*' to 'u8* {aka unsigned char*}' [-fpermissiv

     rc = sqlite3WalReadFrame(pPager->pWal, iFrame, pgsz, pPg->pData);
                                                                    ^
c:\mingw\include\sqlite3.c:43946:20: note: initializing argument 4 of 'int sqlite3WalReadFrame(Wal*, u32, int, u8*)'
 SQLITE_PRIVATE int sqlite3WalReadFrame(Wal *, u32, int, u8 *);

Aun asi no puedo:

Código
  1. g++ -Wall -Werror -pedantic -std=c++11 -pthread -o SQLite3-Amalgamati
  2. on_example SQLite3-Amalgamation_example.c -Wall -Werror -pedantic -std=c++11 -pthread
203  Programación / Programación C/C++ / Re: AYUDA Reserva de vuelos en C en: 15 Abril 2016, 01:36 am
Y tu DUDA ? donde tienes el probleama ?
204  Programación / Programación C/C++ / Re: NEcesito ayuda con un encriptador en: 15 Abril 2016, 00:22 am
Obvio que no  ;D

Un char ('A') es una constante de tipo char que lo puedas asignar es otro cuento
205  Programación / Programación C/C++ / Re: NEcesito ayuda con un encriptador en: 14 Abril 2016, 22:56 pm
Obviamente excelente comentario el de @MAFUS ya que la mayoria no lo sabiamos  ;D

Respecto de "los char no son solo letras, son unas variables de 8bit, es decir se pueden interpretar como numeros... puedes hacer"  mas bien los chars son constantes
206  Programación / Programación C/C++ / Re: AYUDA!! CALCULAR MEDIA, MEDIANA, MODA Y DESVIACION ESTANDAR en: 14 Abril 2016, 21:06 pm
Te diré solo una cosa:

No debes hacer todo en el main() y tampoco postear un programa completo lleno de entradas y salidas cuando en realidad solo estas buscando funciones.
207  Programación / Programación C/C++ / Re: programacion de herramienta en: 14 Abril 2016, 20:38 pm
Yo haria esa parte en C#
208  Programación / Programación C/C++ / Re: Problema basico con listas en C en: 14 Abril 2016, 20:33 pm
Me funcionó perfecto y lo entendí  ;-)

Como conclusión adicional saco que:

Código
  1. pp = &p;  
  2. *pp = p;

Muchisisisimas gracias!


PD: como lista es lo mismo que *nodo, hice unos cambios minimos en el typedef struct:

Código:
typedef struct node_t {
int value;
struct node_t* next;
} nodo, *nodoP, *lista, **nodoPP, **listaP;

209  Programación / Programación C/C++ / Re: Cuadrado en c++ en: 14 Abril 2016, 18:55 pm
Citar
Espero que por lo menos él mío lo pongan en segundo lugar. - :D :D :D

Seguro que si Daniel  :xD  ;D
210  Programación / Programación C/C++ / Re: Problema basico con listas en C en: 14 Abril 2016, 18:54 pm
@MAFUS:  nuevamente gracias..... la verdad es que pensaba que typedef era un alias de struct porque siempre lo vi en ese contexto, aprendí un par de cosas más (mil gracias)

He intentado re-escribir el programa original con lo que me has enseñado pero sigo sin poder usar el doble puntero:

Código
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3.  
  4.  
  5. typedef struct nodo_t {
  6. int value;
  7. struct nodo_t* next;
  8. } node, *lista, **listaPTR;
  9.  
  10.  
  11. lista new_node(int value){
  12. node * n = (node *) malloc(sizeof(node));
  13. n->value = value;
  14. n->next = NULL;
  15. return n;
  16. }
  17.  
  18. lista new_lista(){
  19. return NULL;
  20. }
  21.  
  22.  
  23. void print_list(lista head){
  24. node *prev;
  25.  
  26. prev =  head;
  27. while (prev)
  28. {
  29. printf("%d\n", prev->value);
  30. prev = prev->next;
  31. }
  32. }
  33.  
  34.  
  35. void push(lista list, int value)
  36. {
  37. node *e,*prev,*n;
  38. int v;
  39.  
  40. // camino hasta el final de la list (poco eficiente, mejor tener puntero al final)
  41. e = list;
  42. while (e){
  43. prev = e;
  44. e = e->next;
  45. }
  46.  
  47. // creo nodo
  48. n = new_node(value);
  49.  
  50. if (list == NULL)
  51. {
  52. list = n;
  53. //printf("Elem: %d\n",list->value);
  54. //printf("Elementos: %d\n",count(list));
  55. }
  56. else
  57. // inserto al final
  58. prev->next = n;
  59. }
  60.  
  61.  
  62. int main() {  
  63.  
  64.  
  65. lista l = new_lista();
  66.  
  67. push(l,20);
  68. push(l,40);
  69.  
  70. print_list(l);
  71.  
  72. }
  73.  

He intentado estos reemplazos:

Código
  1. void push(listaPTR listp, int value)   // aqui
  2. {
  3. node *e,*prev,*n;
  4. int v;
  5.  
  6. e = &listp;  // aqui
  7.  


Pero no me funciona...... y realmente necesito entender en que estoy fallando en mi intento y verlo funcionar ya que estoy muy novato.


Nuevamente gracias!
Páginas: 1 ... 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [21] 22
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines