41 Archived Topics

Remove Filter
Member Avatar for eranga262154

Hi all, Using my application I've found a file path anywhere on my machine and store the full path in a CString variable. That is full path, like this, [CODE]G:\Work On\CPP\001_002_003.txt[/CODE] What I want to do is, find the name of the file(without the extension), 001_002_003 according to my example. …

Member Avatar for Gorf
0
2K
Member Avatar for eranga262154

Hi all. I want to read and update a ini file to do some processing. Here is what I have try. [CODE] public static void main(String[] args) { // TODO code application logic here new ReadINIFile().readIt(); //new ReadINIFile().writeIt(); } private void readIt() { try { Properties pro = new Properties(); …

Member Avatar for riahc3
-1
2K
Member Avatar for eranga262154

Hi all, First I create a dynamic buffer and set all element to zero. Then add a int value first to the buffer. Then after that int value add a string to the buffer, actually at the end of int value. But seems my code overwrite each other. Here is …

Member Avatar for kia_barghi60
0
282
Member Avatar for eranga262154

Hi all, I want to create a Java product developer. That means a tool to update an existing version of an application automatically. You guys/gals have any idea. If you know any example regarding that, please put a link here to see. I really appreciate that. Thanks a lot. :)

Member Avatar for eranga262154
0
125
Member Avatar for eranga262154

Hi all, I have a disk file define as [CODE]TCHAR szTempFile[MAX_PATH];[/CODE] What I want to do is, read that file into memory stream. To a buffer. How can I do it.

Member Avatar for eranga262154
0
319
Member Avatar for eranga262154

Hi all, Here is the structure of my XML file. [CODE]<?xml version="1.0"?> <data> <key>468</key> <name>pal</name> <option>10</option> </data>[/CODE] I want to read the option tag value, then increment it by 4 and write it to the same location. So at the end XML file content like this. [CODE]<?xml version="1.0"?> <data> <key>468</key> …

Member Avatar for eranga262154
0
110
Member Avatar for eranga262154

Hi all, I use the swing timer to move a dialog from one position to another. Here is the code I have use. [CODE="java"] // Set the main window display location public void setWindowLocation() { int screenHeight = Toolkit.getDefaultToolkit().getScreenSize().height; int screenWidth = Toolkit.getDefaultToolkit().getScreenSize().width; int frameHeight = this.getHeight(); int frameWidth = …

Member Avatar for eranga262154
0
162
Member Avatar for eranga262154

Hi all, I want to dispose a JFrame using a click-event. So I simply do this on Netbens. [CODE] private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); } [/CODE] But it not work. Do you have any idea. I just want to dispose all the …

Member Avatar for eranga262154
0
150
Member Avatar for eranga262154

Hi all, I already convert a C++ project to C# project. It's fine and working ok. On C++ I use DWORD data type. But in C# for that I used just a int value. Is that ok. Is there compatible data type which I can use for my project. Thanks.

Member Avatar for eranga262154
0
91
Member Avatar for eranga262154

Hi all, I have two C# projects (a service and a windows form) on the same solution. I want to send some parameters to the service on click event of the service start (serviceControllr.Start() method) How can I do that. Thanks.

Member Avatar for JerryShaw
0
111
Member Avatar for eranga262154

Hi all, I want to add a string and a character to two columns of a sql database table. To do that I use a Command object rather to use the same connection on different functions. At the same time used a stored procedure to add data. Hear are some …

Member Avatar for eranga262154
0
204
Member Avatar for eranga262154

Hi all, I've created two columns on the list view as follows. [CODE] ColumnHeader colHed; // Header one colHed = new ColumnHeader(); colHed.Text = "Name"; colHed.Width = 100; this.lwDetails.Columns.Add(colHed); // Header two colHed = new ColumnHeader(); colHed.Text = "Address"; colHed.Width = 200; this.lwDetails.Columns.Add(colHed); [/CODE] Then on a separate function I …

Member Avatar for eranga262154
0
130
Member Avatar for eranga262154

Hi all, I'm working with some date formating, with local and UTC time format. At the end I've print the result to the console as follows. [CODE] cout << stLocal.wMonth << "/" << stLocal.wDay << "/" << stLocal.wYear << " " << stLocal.wHour << ":" << stLocal.wMinute << "\n"; [/CODE] …

Member Avatar for eranga262154
0
140
Member Avatar for eranga262154

Hi all, I've use a CStringArray to store some CStrings in my application. Now I want to use another CStringArray on the same application. So I add another CStringArray instance on the class view, VC++ .Net 2003. When I add and compile it don't give any error message. But when …

Member Avatar for eranga262154
0
930
Member Avatar for eranga262154

Hi all, This question partially related to one of my old question. Reading the time zone information. Now I'm try to do it in this way. User enter the time offset. Using that value search the registry and find the time zone name. Where I'm stuck is how to search …

Member Avatar for eranga262154
0
174
Member Avatar for eranga262154

Hi all, I've create a window as follows, [CODE=cplusplus] void CRtf::Initialize(void) { HWND m_hwnd_RTFBox = CreateWindowEx( WS_EX_APPWINDOW, RICHEDIT_CLASS, "RichTextWindow", WS_BORDER|ES_MULTILINE, 0, 0, 100, 100, ::GetConsoleWindow(), NULL, 0, NULL); } [/CODE] After doing all the process, I've destroyed the window as well. My question is this. I use the above handler …

Member Avatar for eranga262154
0
105
Member Avatar for eranga262154

Hi all, I'm going to learn a new subject on C++. Working with Windows API. Since I work with Java there is no API used, but I feel it is better to work a little with APIs. Here is my attempt for that. I want to read the system time …

Member Avatar for WolfPack
0
112
Member Avatar for eranga262154

Hi all, I have a function that calculated two int values. I call the function only by using a string and calculated those two int values. I want to return that two int values from the function when I call it with a string. Look at the following function, [CODE] …

Member Avatar for rajatC
0
123
Member Avatar for eranga262154

Hi all, I've create a window using CreateWindowEx windows API and do some work on it. Thats fine. But for the safer operation at the end of all the processing I want to close/destroy the window. I've try this, [CODE] BOOL clsWin = DestroyWindow(m_hwnd_RTFBox); if(clsWin != 0) { printf("SS"); } …

Member Avatar for eranga262154
0
442
Member Avatar for eranga262154

Hi, I want to count the number of characters of a string. Try to do it as follows. [CODE=cplusplus] int iSpace = 0; int iLength; string strTemp("This is a line of text"); iLength = strTemp.length(); cout << iLength << endl; for(int i = 0; i < iLength; i++) { if((strTemp.at(i) …

Member Avatar for eranga262154
0
159
Member Avatar for eranga262154

Hi all, I want to find the number of words in a rich edit control. There is no direct class member to do this. So I think if I can count the number of word break and line brake then it is easy. But it is also not easy. On …

Member Avatar for WolfPack
0
898
Member Avatar for eranga262154

Hi all, For later use I want to create dll file, internally using MFC. I used MFC because it is so easy to do my job. So used the MFC-DLL Visual C++ project and code my project. Its ok. Later add another Console Application which support MFC as well. I …

Member Avatar for eranga262154
0
195
Member Avatar for eranga262154

Hi all, What is the easiest way to convert a CString into a standard C++ sting. Thanks

Member Avatar for eranga262154
0
273
Member Avatar for eranga262154

Hi all, I want to read a Rich Text Format file and get texts form it only. So, what I have done is according to RTF specification start to code detecting tags. Actually it is too hard, because RTF format has more that 1000 tags. If I going to find …

Member Avatar for eranga262154
0
1K
Member Avatar for eranga262154

Hi all, I have a string(not a CString), actually a file path. As an example, [CODE]c:\Test\MyProject\G00062_002_01.srf[/CODE] Then in following way get some data. [CODE] string FullPath = c:\Test\MyProject\G00062_002_01.srf string filePath = FullPath.GetFileTitle(); string groupID; string sessionId; string partID; groupID = filePath.substr(1, 5); sessionId = filePath.substr(7, 3); partID = filePath.substr(11, 2); …

Member Avatar for Duoas
0
115
Member Avatar for eranga262154

On my MFC application I read file and do some process on it. Here is the code I used to open and read only. [CODE=cplusplus] CFile srf_ReadFile; char * srf_FilePath = "ReadFile_001.txt"; if(srf_ReadFile.Open(srf_FilePath, CFile::modeRead)) { // Do the required process here on ReadFile_001.txt }[/CODE] So, the file should be always …

Member Avatar for eranga262154
0
138
Member Avatar for eranga262154

Hi all, The topic is my question. I’ll explain it more. Just look at the following C++ code segment, [CODE=cplusplus] if(number_1 == number_2); { std::cout << number_1 << " == " << number_2 << std::endl; } [/CODE] Note that, I have put a semicolon just after the right parentheses. It’s …

Member Avatar for eranga262154
0
1K
Member Avatar for eranga262154

Hi all, I want to use a dynamic buffer in one of my application. I'll explain it in this way. Depend on one of my calculation I found a number(int value), and I want to define a buffer size to that value. Then after doing all the required process need …

Member Avatar for eranga262154
0
87
Member Avatar for eranga262154

Hi all, I want to find the end of file in a CFile. What I've do up to now is, find the length of the file in bytes. Then do the required process with the number of bytes. Here is the code, [CODE=C++] int length = 0 ; CString str …

Member Avatar for eranga262154
0
564
Member Avatar for eranga262154

Hi all, I create a database on SQL 2005 Express edition and link it to a C++/MFC application as follows. It wont gives any compile time errors. But at run time, it gives an error. Here are details. Link the database in OnInitDialog() here is the code [code=c++] BOOL CSRFDBDlg::OnInitDialog() …

Member Avatar for eranga262154
0
113
Member Avatar for eranga262154

Hi all, I want to read a stream of bites/bytes as a String. Here's what I have done up to now. Using a buffer I found that number of bytes, which include a text message from a binary file. Now what I want is to read those bytes stream as …

Member Avatar for Ancient Dragon
0
242
Member Avatar for eranga262154

Hi all, I want to write some text(simply a string of characters) to the edit control on a click event. How can I do that. I know it is able to write something to the control using member function, [CODE]GetDlgItemText()[/CODE] by passing two arguments, control ID and string variable. Is …

Member Avatar for eranga262154
0
179
Member Avatar for eranga262154

Hi all, In my MFC application I've create two buttons, OPEN and CLOSE, used to open a text file and close it. I do it as follows. [CODE=cplusplus] void CSRFToolDlg::OnBnClickedOpen() { char* ReadFileName = "G:\\Work On\\CPP\\SRFTool\\text_file.txt" ; if(openFile.Open(ReadFileName, CFile::modeCreate | CFile::modeReadWrite)) { AfxMessageBox("File creates successfully", MB_OK) ; } else { …

Member Avatar for eranga262154
0
125
Member Avatar for eranga262154

Hi all, I have a console application, and I want to run it though a GUI. Its a simple GUI. Say there is a button called "Run", when I click the button need to execute the application do the task. Can you guys guide me to do it. I'm really …

Member Avatar for n.aggel
0
173
Member Avatar for eranga262154

I'll explain my issue in this way. I've use a structure to get some data of a byte stream as follows. [CODE] 1. struct pac_cont 2. { 3. unsigned int des_list ; 4. unsigned int mem_ID ; 5. unsigned char dm_con ; 6. unsigned char ser_ID ; 7. unsigned short …

Member Avatar for eranga262154
0
1K
Member Avatar for eranga262154

Hi all, I want to use a function to write some values to a text file. That function is called from the main function. Every time when I can that function from main, the perviously written value is overwrite. That's true, it wont work. So what I have done is …

Member Avatar for eranga262154
0
154
Member Avatar for eranga262154

I've read 4 consecutive bytes from a binary file, and store the value as follows, [CODE] int main() { char next4[4] ; while(!fileopen.eof()) { fileopen.read (next4, 4 ) ; } } [/CODE] What I want to do is, that value in next4 want to convert into a decimal/int value. How …

Member Avatar for eranga262154
0
200
Member Avatar for eranga262154

I have a binary file, contain set of stream, and I want to find some information there. What I have done up to now is read the file, open it and count the number of streams three. I'm stuck now. Just consider one stream. I want to skip first 4 …

Member Avatar for eranga262154
0
2K
Member Avatar for eranga262154

Can someone explain, how can read a binary file. I'm really nervous with this.

Member Avatar for eranga262154
0
324
Member Avatar for eranga262154

I have a binary data block(a byte), and I want to convert it to decimal. Is there any inbuilt function to do that.

Member Avatar for eranga262154
0
109
Member Avatar for eranga262154

Hi all, I have just start to work on C++. I want to open a text file, then write few text there. This is the code I wrote for that. [CODE]#include <iostream> #include <fstream> using namespace std; int main() { ofstream file; file.open ("example.txt"); if(file.is_open()) { file << "Write a …

Member Avatar for eranga262154
1
170

The End.