Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About LostAndConfused

  • Rank
  1. LostAndConfused

    Noob Text Database - Help!

    This is assuming you are using single byte characters "ANSI" #include <io.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> int _tmain(int argc, _TCHAR* argv[]) { int hFile = NULL; // file handle char data[] = "My Name\0"; // junk data to write to file char buffer[512]; // buffer to hold the data read back in memset( (void*)buffer, 0, 512 );// initialize memory // open the file hFile = _open("database.txt", _O_TEXT | _O_CREAT | _O_RDWR | _O_APPEND, _S_IWRITE ); _write( hFile, (void*)data, strlen(data) ); // write the data _write( hFile, (void*)"\r\n", 2 ); // carriage return linefeed _close(hFile); // close the file // reopen the file -- just to show you that the data is not truncated hFile = _open("database.txt", _O_TEXT | _O_CREAT | _O_RDWR | _O_APPEND, _S_IWRITE ); _write( hFile, (void*)data, strlen(data) ); // write the data _write( hFile, (void*)"\r\n", 2 ); // carriage return linefeed _lseek( hFile, 0L, SEEK_SET ); // move the read head to the first byte _read( hFile, buffer, 512 ); // load the data from the file into the buffer _close(hFile); // close the file printf( buffer ); // print the data to the dos window return 0; }
  2. LostAndConfused

    int to string in unicode

    I compiled it and ran it before posting it. And the question says "UNICODE" so I assumed that is what was defined.
  3. LostAndConfused

    C# for the VB.net programmer?

    Is it that you want to know C#? Or, do you think it will provide an advantage? Point being; man, if you are happy with VB and you really don't want to change -- just do it in VB. Both VB and C# implement DX in retained, "managed", mode. Thoughts from the grumpy old guy.
  4. LostAndConfused

    Inheritance issue

    That is very cool...
  5. LostAndConfused

    Extra whitespaces from a text file

    When you read the data in -- it is this: \r\nStore\r\nLocal Store then when you print it you add a newline: "\r\nStore" + endl "\r\nLocal Store" + endl The data will display this way: 1: 2: Store 3: 4: Local Store
  6. LostAndConfused

    DLL question

    Standard DLL's are loaded, "injected", into a process. Each ordinal, "function entry" will have it's own virtual address. Point: a new instance of a module, "DLL", is loaded into each process. The only module that is insured to have the same address table is the kernel, "Kernel32.dll". However, the operating system does track the attached count, how many times the dll has been injected into a process and how many module handles and id's the module has been issued. You could use something like this to find all the processes a DLL was loaded into. EnumProcessModules(hProcess, hModule, 500, &dwCntNeeded); for(index=0;index<(int)(dwCntNeeded/sizeof(HMODULE));index++) { GetModuleFileNameEx(hProcess, hModule[index],szModuleFileName,512); if(strcmp(lpModulePath,szModuleFileName)==0) { } } CloseHandle(hProcess); Thank you -- from Mr. Old and Grumpy
  7. LostAndConfused

    Char[4] to UInt32

    Ahhhhh !!! -10 for the old timer... LOL
  8. LostAndConfused

    C# struct

    I agree, I don't think it needs to be unsafe unless you truly plan on working with the addresses.
  9. LostAndConfused

    C# struct

    The struct is declared but it is not defined, you need to create a struct object. ALSO: Add the closing ")" in the Write calls. bWriter.Write((char*)name1; <--- bWriter.Write((char*)name2; <--- bWriter.Write((char*)name3; <--- struct _myStruct { name1 } myObject; myObject.name1 Here is what I'm saying: unsafe struct Credentials { public fixed char name1[32]; public fixed char name2[32]; public fixed char name3[32]; } MyCredentials; bWriter.Write((char*)&MyCredentials.name1); bWriter.Write((char*)&MyCredentials.name2); bWriter.Write((char*)&MyCredentials.name3);
  10. LostAndConfused

    Inheritance issue

    I'm not sure if I understand, but here is how one might go about an interface. class CBase { public: virtual void MyFunc( void ) = 0; }; class COne : public CBase { public: void MyFunc( void ){ printf("COne function\n");} }; class CTwo : public CBase { public: virtual void MyFunc( void ){ printf("CTwo function\n");} }; class CThree : public CTwo { public: void MyFunc( void ){ printf("CThree function\n");} }; int _tmain(int argc, _TCHAR* argv[]) { CBase* pInterface; COne one; CTwo two; CThree three; pInterface = &one; pInterface->MyFunc(); pInterface = &two; pInterface->MyFunc(); pInterface = &three; pInterface->MyFunc(); return 0; }
  11. LostAndConfused


    SYSTEMTIME SystemTime GetSystemTime( &SystemTime ); SystemTime.wYear; SystemTime.wMonth; SystemTime.wDayOfWeek; SystemTime.wDay; SystemTime.wHour; SystemTime.wMinute; SystemTime.wSecond; SystemTime.wMilliseconds;
  12. LostAndConfused

    Char[4] to UInt32

    why not just use atol() ?? unsigned int iTmp = (unsigned int) atol( &buffer ); Is this to much "old timer"? lol
  13. LostAndConfused

    int to string in unicode

    float rr = 1.0f; TCHAR fps[20]; swprintf( (wchar_t*)fps, L"%f", rr ); // - OR - _stprintf( (wchar_t*)fps, L"%f", rr );
  14. LostAndConfused

    void* casting

    That is not my qoute, it is the one who asked the question. :) I don't know how to use all the fancy quote tools... LOL
  15. LostAndConfused

    2 ports

    Projection Matrix ???????? It's 01:00 in the morning, I tired and I think I have something to contribute but I'm probably wrong. LOL I think it would be the second parameter in the second function..... if I am wrong I am very sorry. D3DXMATRIXA16 matProj; D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 1000000.0f ); pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!