Search Results

Search found 154 results on 7 pages for 'cstring'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Problem creating PostGIS template database

    - by omat
    I am trying to build a template geographic database for PostGIS (1.5) on Mac OS X Snow Leopard (10.6) for my GeoDjango application. I am following: http://docs.djangoproject.com/en/dev/ref/contrib/gis/install/#creating-a-spatial-database-template-for-postgis I've managed to come up to the point where the provided postgis.sql should be run (i.e. psql -d template_postgis -f $POSTGIS_SQL_PATH/postgis.sql) At that point I am getting an error at the first SQL statement that is tried to be run. When I try that on the psql prompt the result is as follows: template_postgis=# CREATE OR REPLACE FUNCTION st_spheroid_in(cstring) RETURNS spheroid AS '/usr/local/pgsql/lib/postgis-1.5','ellipsoid_in' LANGUAGE 'C' IMMUTABLE STRICT; NOTICE: type "spheroid" is not yet defined DETAIL: Creating a shell type definition. ERROR: could not load library "/usr/local/pgsql/lib/postgis-1.5.so": dlopen(/usr/local/pgsql/lib/postgis-1.5.so, 10): Symbol not found: _DatumGetFloat4 Referenced from: /usr/local/pgsql/lib/postgis-1.5.so Expected in: /opt/local/lib/postgresql83/bin/postgres in /usr/local/pgsql/lib/postgis1.5.so Any ideas what might have been messed up?

    Read the article

  • how to omit extra bits in a file?

    - by thinthinyu
    I want to omit extra bit in txt file.eg ....ÿ 0111111110111101100011011010010001 in this string we want to omit extra bit "ÿ " which is appeared when we save a binary string. Save fun is as follow. please help me. void LFSR_ECDlg::Onsave() { this-UpdateData(); CFile bitstream; char strFilter[] = { "Stream Records (*.mpl)|*.mpl| (*.pis)|*.pis|All Files (*.*)|*.*||" }; CFileDialog FileDlg(FALSE, ".mpl", NULL, 0, strFilter); if( FileDlg.DoModal() == IDOK ) { if( bitstream.Open(FileDlg.GetFileName(), CFile::modeCreate | CFile::modeWrite) == FALSE ) return; CArchive ar(&bitstream, CArchive::store); CString txt; txt=""; txt.Format("%s",m_B);//by ANO AfxMessageBox (txt);//by ANO txt=m_B;//by ANO ar <<txt;//by ANO ar.Close(); } else return; bitstream.Close();

    Read the article

  • Doing extra initialisations on a MFC Dialog in Visual Studio 2008 Pro

    - by theunanonim
    How do I make extra initializations on a modal dialog before calling DoModal(); ? I have a main Dialog (the one that is created automatically when I select new MFC Application in Visual Studio 2008 Professional). When I click a button on this dialog I want to open another dialog and set a CString value into a CEdit control. my code: ... void OnClickedButtonX(){ SecondDialogClass Dlg2; Dlg2.asocVar2Cedit.SetWindowTextW(L"my text"); Dlg2.DoModal(); } //asocVar2Cedit is the associeted control variable to the //CEdit control on the second Dialog (Right Click > Add Variable.. in VSC++) ... this code generates a "Debug Assertion" error in winocc... Any ideas ? Thank you in advance.

    Read the article

  • Why does this crash?

    - by Adam Driscoll
    I've been banging my head...I can't pretend to be a C++ guy... TCHAR * pszUserName = userName.GetBuffer(); SID sid; SecureZeroMemory(&sid, sizeof(sid)); SID_NAME_USE sidNameUse; DWORD cbSid = sizeof(sid); pLog->Log(_T("Getting the SID for user [%s]"), 1, userName); if (!LookupAccountName(NULL, (LPSTR)pszUserName, &sid, &cbSid, NULL, 0, &sidNameUse)) { pLog->Log(_T("Failed to look up user SID. Error code: %d"),1, GetLastError()); return _T(""); } pLog->Log(_T("Converting binary SID to string SID")); The message 'Getting the SID for user [x] is written' but then the app crashes. I'm assuming is was the LookupAccountName call. EDIT: Whoops userName is a MFC CString

    Read the article

  • Using objects with STL vector - minimal set of methods

    - by osgx
    Hello What is "minimal framework" (necessary methods) of object, which I will use with STL <vector>? For my assumptions: #include <vector> #include <cstring> using namespace std; class Doit { private: char *a; public: Doit(){a=(char*)malloc(10);} ~Doit(){free(a);} }; int main(){ vector<Doit> v(10); } gives *** glibc detected *** ./a.out: double free or corruption (fasttop): 0x0804b008 *** Aborted and in valgrind: malloc/free: 2 allocs, 12 frees, 50 bytes allocated.

    Read the article

  • Sort CMap Key by String Length

    - by Yan Cheng CHEOK
    Previously, I am using STL map to perform the mentioned task. struct ltstr { bool operator()(std::string s1, std::string s2) const { const int l1 = s1.length(); const int l2 = s2.length(); if (l1 == l2) { // In alphabetical order. return s1.compare(s2) < 0; } // From longest length to shortest length. return l1 > l2; } }; std::map<std::string, int, ltstr> m; How can I perform the same task using CMap? // How to make key sorted by string length? CMap<CString, LPCTSTR, int, int> m;

    Read the article

  • Programmatically selecting file in explorer

    - by flashk
    In my application I can programmatically open explorer and select a file using the following code: void BrowseToFile(LPCTSTR filename) { CString strArgs; strArgs = _T("/select,\""); strArgs += filename; strArgs += _T("\""); ShellExecute(0, _T("open"), _T("explorer.exe"), strArgs, 0, SW_NORMAL); } My problem is that if I call this function a second time with a different file, but in the same folder, the selection in explorer does not change to the new file, but remains on the previous file. For example, if I call my function with C:\path\to\file1.txt, a new explorer window will open and file1.txt will be selected. If I call my function a second time with C:\path\to\file2.txt, the existing explorer window will be activated, but the selection will still be on file1.txt. Is there a way to force explorer to update the selection or a better way to accomplish this?

    Read the article

  • Problem with array of elements of a structure type

    - by kobac
    I'm writing an app in Visual Studio C++ and I have problem with assigning values to the elements of the array, which is array of elements of structure type. Compiler is reporting syntax error for the assigning part of the code. Is it possible in anyway to assign elements of array which are of structure type? typedef struct { CString x; double y; } Point; Point p[3]; p[0] = {"first", 10.0}; p[1] = {"second", 20.0}; p[2] = {"third", 30.0};

    Read the article

  • How to connect to a SQLite database in iphone

    - by Lee
    I am attempting converting an application from VB6 to an iphone app. In the VB version, the database is in Access. But, I have read that I need to convert it to SQLite. How I amend the following code to switch from Access to SQLite? cnList = new ADODB.Connection(); rsList = new ADODB.Recordset(); cnList.Provider = "Microsoft.Jet.OLEDB.4.0;"; cnList.ConnectionString = "Persist Security Info=False;"+CString("Data Source=cbe.mdb"); cnList.Open();

    Read the article

  • is memset(ary,0,length) a portable way of inputting zero in double array

    - by monkeyking
    The following code uses memset to set all the bits to zero #include <iostream> #include <cstring> int main(){ int length = 5; double *array = new double[length]; memset(array,0,sizeof(double)*length); for(int i=0;i<length;i++) if(array[i]!=0.0) std::cerr<< "not zero in: " <<i <<std::endl; return 0; } Can I assume that this will work on all platforms? Does the double datatype always correspond to the ieee-754 standard? thanks

    Read the article

  • CInternetSession::OpenURL exception if headers are defined. Works fine if not. Why?

    - by Jesse
    Trying to log the application version details in our weblogs using the headers: Should be a one liner..but for some reason whenever I specify anything but NULL for the headers it causes an exception (InternetOpenUrl() call returns NULL) - anyone able to explain why? CInternetSession internet; CHttpFile * pHttpFile; CString headers;// = APPLICATION_SUITE_NAME; DWORD dwHeadersLength = -1; headers.Format("%s %s %s\n",APPLICATION_SUITE_NAME,SHORT_APPLICATION_VERSION,BUILDNO_STR); pHttpFile =(CHttpFile *) internet.OpenURL(lpszURL, 1, INTERNET_FLAG_TRANSFER_ASCII|INTERNET_FLAG_DONT_CACHE, headers, dwHeadersLength); Without the headers, dwHeadersLength parameter (eg. pass in NULL,-1) then it goes through fine and I see the request come through to our website. But why does it fail if I pass in custom headers?

    Read the article

  • C++'s char * by swig got problem in Python 3.0

    - by gpliu3
    Our C++ lib works fine with Python2.4 using Swig, returning a C++ char* back to a python str. But this solution hit problem in Python3.0, error is: Exception=(, UnicodeDecodeError('utf8', b"\xb6\x9d\xa.....",0, 1, 'unexpected code byte') Our definition is like(working fine in Python 2.4): void cGetPubModulus( void* pSslRsa, char* cMod, int* nLen ); %include "cstring.i" %cstring_output_withsize( char* cMod, int* nLen ); Suspect swig is doing a Bytes-Str conversion automatically. In python2.4 it can be implicit but in Python3.0 it's no long allowed.. Anyone got a good idea? thanks

    Read the article

  • VS2005 Compilation Problem with Settings

    - by vijay.j
    I am trying to integrate PJNSMTPCONNECTION CLASSES in my project; they say that those classes do not use MFC. My project is with the setting like MT, and using standard library linking. When I try to compile, I am getting CSTRING not defined and fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h> If I include afx.h and remove windows.h, I am getting iDLLMain already defined errors. How do I resolve these problems, please?

    Read the article

  • C++: conjunction of binds?

    - by Helltone
    Suppose the following two functions: #include <iostream> #include <cstdlib> // atoi #include <cstring> // strcmp #include <boost/bind.hpp> bool match1(const char* a, const char* b) { return (strcmp(a, b) == 0); } bool match2(int a, const char* b) { return (atoi(b) == a); } Each of these functions takes two arguments, but can be transformed into a callable object that takes only one argument by using (std/boost)bind. Something along the lines of: boost::bind(match1, "a test"); boost::bind(match2, 42); I want to be able to obtain, from two functions like these that take one argument and return bool, a callable object that takes two arguments and returns the && of the bools. The type of the arguments is arbitrary. Something like an operator&& for functions that return bool.

    Read the article

  • Doing extra initialisations on a MFC Dialog in Visual Studio C++ 2008 Pro

    - by theunanonim
    How do I make extra initializations on a modal dialog before calling DoModal(); ? The whole application is created using VS wizards. I have a main Dialog (the one that is created automatically when I select new MFC Application in Visual Studio 2008 Professional). When I click a button on this dialog I want to open another dialog and set a CString value into a CEdit control. my code: ... void MainDlg::OnClickedButtonX(){ SecondDialogClass Dlg2; Dlg2.asocVar2Cedit.SetWindowTextW(L"my text"); Dlg2.DoModal(); } //asocVar2Cedit is the associeted control variable to the //CEdit control on the second Dialog (Right Click > Add Variable.. in VSC++) ... this code generates at runtime a "Debug Assertion" error in winocc... Any ideas ? Thank you in advance.

    Read the article

  • Unable to get Processor Speed in Device

    - by mukesh
    Hi i am using QueryperformanceFrequency to get the No of cycle i.e processor speed. But it is showing me the wornd value. It is written in the specicfication is the Processor is about 400MHz, but what we aregetting through code is something 16MHz. Please porvide any pointer : The code for Wince device is: enter code here LARGE_INTEGER FrequnecyCounter; QueryPerformanceFrequency(&FrequnecyCounter); CString temp; temp.Format(L"%lld",FrequnecyCounter.QuadPart)`AfxMessageBox(temp); Thanks, Mukesh

    Read the article

  • Write data into .txt file created by CFileDialog, in C++

    - by younevertell
    I wanna Write data into .txt file created by CFileDialog, in C++. The problem I am facing is that below codes doesn't work, although there is no build error. The .txt file created by CFileDialog can not be found for some reason. What's wrong the code? what's the efficient way to Write data into .txt file created by CFileDialog, in C++? Thanks CFileDialog dlg(FALSE, NULL, NULL, OFN_OVERWRITEPROMPT, _T("My Data File (*.txt)|*.txt||")); if(dlg.DoModal() != IDOK) return; CString filename = dlg.GetPathName(); ofstream outfile (filename); int mydata = 10; outfile << "my data:" << mydata << endl; outfile.close();

    Read the article

  • Storing objects in STL vector - minimal set of methods

    - by osgx
    Hello What is "minimal framework" (necessary methods) of object, which I will store in STL <vector>? For my assumptions: #include <vector> #include <cstring> using namespace std; class Doit { private: char *a; public: Doit(){a=(char*)malloc(10);} ~Doit(){free(a);} }; int main(){ vector<Doit> v(10); } gives *** glibc detected *** ./a.out: double free or corruption (fasttop): 0x0804b008 *** Aborted and in valgrind: malloc/free: 2 allocs, 12 frees, 50 bytes allocated.

    Read the article

  • How do you extract data from a Date/Time widget from a C++ MFC dialog in VS2008

    - by jkerian
    This is a fairly basic question, but I haven't been able to find any from-to guides from VS6-VS2008. I have a dialog box that contains controls of various types, I've discovered the way of auto-generating OnBnClickedMyFooBarButtonHere() methods via the Properties dialog on the dialog editor. I can also use CWnd::GetDlgItemText(int ,CString &) to extract text, and the oddly paramaterized GetDlgItemInt(int, bool*, bool) to extract signed integers, but is there really no other option for a Date or Time value other than Manually adding in all the DDX_ crap that the class wizard used to do in VS6 Using GetDlgItemText and then parsing whatever it gives me?

    Read the article

  • ExpandEnvironmentStrings Not Expanding My Variables

    - by Adam Driscoll
    I have a process under the Run key in the registry. It is trying to access an environment variable that I have defined in a previous session. I'm using ExpandEnvironmentStrings to expand the variable within a path. The environment variable is a user profile variable. When I run my process on the command line it does not expand as well. If I call 'set' I can see the variable. Some code... CString strPath = "\\\\server\\%share%" TCHAR cOutputPath[32000]; DWORD result = ExpandEnvironmentStrings((LPSTR)&strPath, (LPSTR)&cOutputPath, _tcslen(strPath) + 1); if ( !result ) { int lastError = GetLastError(); pLog->Log(_T( "Failed to expand environment strings. GetLastError=%d"),1, lastError); } When debugging Output path is exactly the same as Path. No error code is returned. What is goin on?

    Read the article

  • C++ vector insights

    - by Sunscreen
    Hi, I am a little bit frustrated of how to use vectors in C++. I use them widely though I am not exactly certail of how I use them. Below are teh questions? If I have a vector lets say: std::vector<CString> v_strMyVector, with (int)v_strMyVector.size > i can I access the i member: v_strMyVector[i] == "xxxx"; ? (it works, though why?) Do i always need to define an iterator to acces to go to the beginning of the vector, and lop on its members ? What is the purpose of an iterator if I have access to all members of the vector directly (see 1)? Thanks in advance, Sun

    Read the article

  • How to convert char to LPCTSTR (MFC)?

    - by Shark
    Is there any way to do this? This is what I am trying to do: char s[] = { 'a', 'b' }; label.SetWindowTextW(s[1]); label is CStatic typed, _UNICODE is defined. Any help would be appreciated. UPD: Tried to use CString(s[1]), it works for ASCII characters but others won't work. E. g. for the ? it returns |.

    Read the article

  • What is the meaning of this pData[1+2*i]<<8|pData[2+2*i] C++ syntax?

    - by user543265
    what is the meqaning of pData[1+2*i]<<8|pData[2+2*i] where pData[ ] is the array containing BYTE data? I have the following function in the main function { .......... .... BYTE Receivebuff[2048]; .. ReceiveWavePacket(&Receivebuff[i], nNextStep); .... ... .. } Where Receivebuff is the array of type BYTE. ReceiveWavePacket(BYTE * pData, UINT nSize) { CString strTest; for(int i = 0 ; i < 60 ; i++) { strTest.Format("%d\n",(USHORT)(pData[1+2*i]<<8|pData[2+2*i])); m_edStatData.SetWindowTextA(strTest); } } I want to know the meaning of ",(USHORT)(pData[1+2*i]<<8|pData[2+2*i]). Can any body please help me?

    Read the article

  • What can you do in ::OnInitDialog() Visual Studio 2008 C++

    - by flirishman
    What can or cannot you do in ::OnInitDialog() Visual Studio 2008 C++ I would like to write out some text on the dialog at the dialog startup. If I put the same code in a PUSH-BUTTON OnBnClicked it works. If I put it in the OnInit, it does not give me the text on the screen. I'm assuming at the OnInit, my dialog box is not completely up, so I cannot write on it? CRect drawRect; drawRect.left = 00; // Shifts text to right drawRect.right = 300; drawRect.top = 00; // How Far Down drawRect.bottom = 300; // Clear out any previous name CString strBlank = "Book Name"; SSTextOut(this->GetDC(), strBlank, &drawRect, DT_LEFT); The function I am writing to is described in http://www.codeproject.com/KB/GDI/SSTextOut.aspx

    Read the article

  • Avoid Resource Conflict

    - by Yan Cheng CHEOK
    I have a MFC exe, trying to dynamic load a MFC dll. // This is code in MFC exe HINSTANCE h = AfxLoadLibrary(_T("DLL.dll")); typedef void(*FUN)(); FUN fun = (FUN)GetProcAddress(h, "loveme"); FreeLibrary(h); Both MFC exe and MFC dll, are having their own resource file. However, I realize that, if MFC exe and MFC dll are having a same resource ID, conflict may occur. // This is code in MFC dll. Both exe and dll, are having resources with // ID 101. CString s; s.LoadString(101); // Resource 101 in exe is being shown :( AfxMessageBox(s); May I know how I can avoid resource ID conflict problem? Can we have two resource in both MFC and DLL, although their ID is different, but they are independent from each other? This means, DLL will only load DLL's resource. EXE will only load EXE's resource.

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >