Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

Kogee San

@Kogee San
About
Posts
29
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C programming in Linux warning message
    K Kogee San

    wow. Thanks man. This explanation really helps my understanding in C character pointers. I will try this testing code later. Thanks a lot.

    Linux, Apache, MySQL, PHP question help linux testing

  • C programming in Linux warning message
    K Kogee San

    yeah, That is basically what is I intended to do. I understand with the code you gave me since it is a basic strcpy() syntax. Anyway, thanks for the explanation behind the scene because that is the important thing i want to know. however, im not quite sure about what you mentioned of *opt_socket_name[5] means an array of 5 strings.. So does it means that *opt_socket_name[5] points to 5 strings? What I mean is like this :- *opt_socket_name[0] is pointing to a string for example char string1[10]; *opt_socket_name[1] is pointing to a string example char string2[10]; *opt_socket_name[2] is pointing to a string for example char string3[10]; *opt_socket_name[i] is pointing to a string for example char stringi[10]; How can i make a program to test this if my understanding here is true. The test is just to secure my knowledge and understanding. Thank a lot.

    Linux, Apache, MySQL, PHP question help linux testing

  • C programming in Linux warning message
    K Kogee San

    Hello everyone. Im not quite sure either Im in the right forum since my question is basically on C programming, coding in the linux environment. After I gcc, I got this warning message "warning: passing argument 1 of 'strcpy' makes pointer from integer without a cast" When I run the program, I will have a segmentation error fault. This is the code snippet below.

    static const char *opt_socket_name[5];

    main()
    {
    int i = 0;

    strcpy(*opt_socket_name[i], "testing")
    printf("%s", opt_socket_name);
    }

    Im not quite sure why this happen. Can anyone here help me and explain what is going on behind the scene. Can you guys also give an opinion on how to make it work. A brief on what I am doing is actually, creating multiple socket with different names. I am just about to create different names, but the warning above appeared. Is there any other options to do this? The above code is just a small testing code to make the strcpy() works. Im quite new in programming so currently im learning. :-D Thanks

    Linux, Apache, MySQL, PHP question help linux testing

  • convert an array unsigned char to a string
    K Kogee San

    Hello I need help on how to convert an array which its datatype is unsigned char to a string. The scenario is like this. I detect the mac address of a computer using GetAdaptersInfo API. So the return result of the call is the current MAC address which is available and the return Mac address is an unsigned char. So I can print the MAC address by using this code below :- static void showMACArray(unsigned char MACData[]) { printf("%02X-%02X-%02X-%02X-%02X-%02X\n", MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]); } I want to print out as such that the Mac Data is in a string just like the code below :- printf("The Mac address would be %s\n", MACData); I understand that i must concatenate each of the MACData[] array so that it combines together using strcat(). However, before using strcat(), i must convert each of the MACData unsigned char array to a string so that it can support the strcat() function. How can I solve this? Thank you and your help is really appreciated.

    C / C++ / MFC question data-structures json help tutorial

  • Connecting a client and server program using .NET framework but different source code
    K Kogee San

    hello mark Thanks for the reply. I just add the byte order method htons and it works. Thanks for the solution. I really2 appreciated it. Also thanks for the tips to take error messages seriously. I will take your advice. I know error messages is important for debugging, but i just consider a simple connection from client/server, thats why i dont want to concern the error messages. I will be careful next time. Thanks again.

    .NET (Core and Framework) csharp c++ sysadmin help dotnet

  • Connecting a client and server program using .NET framework but different source code
    K Kogee San

    hello and thanks for the reply I tried the method you said. So I disable the binding socket. Still, the client could not connect to the server. Actually, there is no error in the code but it just could not connect the client which is programmed in C meanwhile the server side is programmed using C#. So i think it is not about the errno or the WSAGetLastError problem. Actually, this is just only a test program. After i proved that it can connect, then I will produce a real version. I just want to know is there any method or code which can connect a client programmed in C to a server which is programmed in C#. I assume that the connect() call failed since the printf("Cannot connect to server, error no %d occured\n", errno); as in the code snippet will be displayed. So this clearly means that it just could not connect to the server. Anyway, thank for your reply and help. Any other idea's or solution? hehe..

    .NET (Core and Framework) csharp c++ sysadmin help dotnet

  • Connecting a client and server program using .NET framework but different source code
    K Kogee San

    Hello. Im doing a client server program where the client program is created using Visual C++.NET meanwhile the server program is created using C#.NET. Just for my own knowledge, can both of these program be connected via a network using TCP protocol. I tried to execute the sample. there was no error but it could not be connected. Which part that must i edit? Is it ok if i only edit the client part (created using C++). This is because the server part also have multithreading mechanism, so i dont want to mess that up. For your information, i tried to connect both client and server using port 5000. I will also include here the connection part of the client and server source code. Did i miss anything in the source code in the code snippet attachment? Thank you and your help is very appreciated. /****** The client program. created using C++.NET ********************/ InitWSA(); sock = socket(AF_INET, SOCK_STREAM, 0); if (sock < 0) { printf("Error no %d occured when creating socket\n", errno); exit(-1); } myaddr.sin_family = AF_INET; myaddr.sin_port = 5001; myaddr.sin_addr.s_addr = INADDR_ANY; status = bind(sock, (struct sockaddr *)&myaddr, sizeof(struct sockaddr)); if(status < 0) { printf("Error no %d occured when binding\n", errno); exit(-1); } receiver.sin_family = AF_INET; receiver.sin_port = 5000; receiver.sin_addr.s_addr = inet_addr("127.0.0.1"); status = connect(sock, (struct sockaddr *)&receiver, sizeof(struct sockaddr)); if (status < 0) { printf("Cannot connect to server, error no %d occured\n", errno); //here is where the message is //displayed where it could not connect to the server. exit(-1); } /********** end source code **************/ /********** the server part. created using C# ***********/ string portStr = textBoxPort.Text; //set the port using port 5000 int port = System.Convert.ToInt32(portStr); // Create the listening socket... m_mainSocket = new Socke(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp); IPEndPoint ipLocal = new IPEndPoint (IPAddress.Any, port); // Bind to local IP Address... m_mainSocket.Bind( ipLocal ); // Start listening... m_mainSocket.Listen(4); // Create the call back for any client connections...

    .NET (Core and Framework) csharp c++ sysadmin help dotnet

  • write data from Visual C++ win32 console application to Microsoft Access using Visual Studio.NET 2005
    K Kogee San

    Hello Im building a client server application where the client will send information to the server using Visual C++ .NET. The communication and sending information to the server has succeed. I want to write the information that is retrieved by the server to Microsoft Access. How can i accomplish this? For your information, Im using the win32 console application as the C++ platform. Is there any sample code which i can refer to? A friend of mine told me that there is something to do with managed C++. I really dont know anything about managed C++. Is it the same with the normal C/C++ code? What are the difference? Sori due to my 'basic' questions. hehe. Kinda desperate currently. Anyway, thank you and your reply is really appreciated.

    C / C++ / MFC csharp c++ question visual-studio sysadmin

  • write data from Visual C++ win32 console application to Microsoft Access using Visual Studio.NET 2005
    K Kogee San

    Hello Im building a client server application where the client will send information to the server using Visual C++ .NET. The communication and sending information to the server has succeed. I want to write the information that is retrieved by the server to Microsoft Access. How can i accomplish this? For your information, Im using the win32 console application as the C++ platform. Is there any sample code which i can refer to? Im quite new to this and still learning. Can you guys also include any lib that needs to be linked to the project and also any header files that i must include. Thank you and your reply is really appreciated.

    C / C++ / MFC csharp c++ question visual-studio sysadmin

  • hidden window
    K Kogee San

    Ok. understand now. So, since i dont want any windows interface for this application, I would like to choose either option 2 or 3. (Use windows application with no window created or go for windows service application" Let say if i choose option 2. How can i create windows application without affecting my network application (client/server) which has been coded in C. Must i use MFC or there are other options which is much more easier to use to create windows application and it can also integrate my client/server application in C. If i choose option 3, does windows service application accepts C as the programming platform? Can it be coded in Microsoft Visual Studio or it uses another programming application. Another thing, must i change the whole code of my client/server or i can use the previous one, just change the platform from visual studio to windows service application. Actually im kinda new to programming so im weak in choosing the requirements. Lastly, thank you from your previous reply and it really helps. Thanks again

    C / C++ / MFC sysadmin help tutorial json

  • hidden window
    K Kogee San

    Hello I have a problem on how to hide an application running in hidden mode. I found a code to hide the window. This code will hide all windows including the dos window. The code is :- #include int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { while(1) { Sleep(1000); } return 0; } main() { /* This is where all of the codes including function calls and API calls is placed here. Example the InitWSA()for initializing windows socket and other API calls */ } Im not sure what does this code do but since i already test the code, it really hides the dos window. A brief about my system, i created client server based application using a win32 console application where the client will communicate and send messages to the server. The network part has already be done and the client currently can send messages to the server meanwhile the server has no problem to display the sent messages from the client. So this means that the client-server part has no problem. One of the requirement of my application is that the client application must be hidden from the user. So, I used the code above to hide the dos window from being seen by the user. At first, the code above didnt work (the dos window can still be seen). There was no error but after i had done some research, i realize that it couldn't work because the linker setting of the project under system tab is by default set to Console (/SUBSYSTEM:CONSOLE). So i changed this setting to Windows (/SUBSYSTEM:WINDOWS). Then after i change these settings, the code above works (the dos window is hidden). How did i know that the code works is because i checked the Windows Task Manager and i saw that under processes tab, there is my *.exe is executing. The problem is that the network part didnt work since the server didnt receive any messages from the client. Then i differentiate the application running under Windows (/SUBSYSTEM:WINDOWS) with the one running under Console (/SUBSYSTEM:CONSOLE). I realize that when the application is running under /subsystem:windows and it is hidden, the windows task manager will display only at the processes running. For instance: my project name is hidden.exe. So, hidden.exe will be displayed only at the Processes running tab. There is no display under the Application running tab. But when i change to /subsystem:console and the dos window c

    C / C++ / MFC sysadmin help tutorial json

  • Running an application automaticaly
    K Kogee San

    ok. i think i already got it by googling some issues that needs to be concerned also following your guide through your comment. I also need to find a way to write the registry by going through a service which could write the registry during my application is installed to the computer. My application is coded using VC++. Anyway, thanks a lot for ure help. Appreciated a lot.

    System Admin windows-admin tutorial question

  • Running an application automaticaly
    K Kogee San

    So u mean that just add a new string value initiating the path of my application in the regedit to both HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run and the program will run automatically after startup? I think adding the registry would be the best choice since i dont want the user to disable my application. Anyway, thanks a lot. Really appreciate it.

    System Admin windows-admin tutorial question

  • Running an application automaticaly
    K Kogee San

    Hello. Anyone here knows how to edit the registry of Windows XP so that one of my application can run automatically once windows startup? Im doing this for one of my final thesis project. Also, is there any options so that i can run the application background (hidden). My application doesnt have any GUI. Its just a win32 console application.

    System Admin windows-admin tutorial question

  • Detecting internet connection using InternetGetConnectedState in VC++
    K Kogee San

    Thanks guys for your help and comments. Really appreciate it.

    C / C++ / MFC help csharp question c++ json

  • Detecting internet connection using InternetGetConnectedState in VC++
    K Kogee San

    wow. It really works. Thanks. Just wanna ask if you dont mind. Why do we need to add windows.h. I always see codes which add windows.h eventhough it is just a hello world printf statement. Just kinda curious. Thanks again.

    C / C++ / MFC help csharp question c++ json

  • Detecting internet connection using InternetGetConnectedState in VC++
    K Kogee San

    Hello again everyone Before that i would like to tell u all that im really new and dumb to .NET. Hope you guys can help me. I tried to search the solution to my problem but still couldnt find anything. What im trying to do is to create a really simple internet connection detection which is running under a win32 console. The program will detect if there is any connection to the internet, if yes then it will print yes. If no connection then it will print out no connection using printf() statement. I know that the InternetGetConnectedState API can help me. but still im not so sure on how to use it. Really dumb me...the scenario is like this I already link the VC++ project to the Wininet.lib since it required that lib and a header file called Wininet.h (as refered in MSDN). I try to code just by adding the header file to the source code #include "stdio.h" #include "Wininet.h" void main() { } using the code above, compile, it generates more than 100 error which particularly made the compiler to stop compiling due to error exceeds 100. all of the errors come from the Wininet.h header file. The first error was "error C2061: syntax error:Identifier 'HINTERNET'. The question is, am i missing something. Does VC++ supports this API? I've search the internet (forums..etc) and all of them were implemented using C# or VB. Is there any source code samples using this API which can be run only in a simple win32 console application? Thank you everyone. Really appreciate any help. Thanks again.

    C / C++ / MFC help csharp question c++ json

  • problem with network programming
    K Kogee San

    Thanks Pallini. I think that should solve it. I altered the code and there are no more error. I didnt update the code on the receiver (server) side yet but i think it should not be a problem. If there are problems, i will get back to you guys again. Thanks alot guys.

    C / C++ / MFC sysadmin help question json

  • problem with network programming
    K Kogee San

    I have problem to send a message to the server application using send() function using winsock.h. Im trying to send my MAC address information to the server. Firstly, i detect the MAC address at the client side using GetAdaptersInfo API. The problem is the MAC address is an unsigned character. The send() function could not send this type of message. The error would produce 'error C2664: 'send' : cannot convert parameter 2 from unsigned char [] to const char. I tried to convert the unsigned char to const char using casting but it is still the same. Maybe i did the casting wrong. How can i solve this? Is there any examples? Thanks

    C / C++ / MFC sysadmin help question json

  • Application requirement
    K Kogee San

    Actually i have receive several opinion from google and also other forums saying that why do i need a console application if we were just going to hide it. Thinking and thinking i still could not understand why. :) . As for my application here, actually what im trying to do is a software agent which will communicate and send information packets to the server for every 5 minutes. (This is where i need a timer to solve this). So this software agent is located at client side where it must be invisible to the user for security reason. The reason i choose win32 Console application as the client application side (software agent) is because I dont have any intention to put any graphical icon to the application. It is pure text based. So I just wanna hide the dos window (text based) so that user did not even know that the program is running background. Is there any option @ API that can help me accomplish this requirement?

    C / C++ / MFC question c++ database json help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups