ssharish2005 62 Posting Whiz in Training

Only in your explanation. You said "I have a C program I am writing and need this program to write to syslog..." Syslog means system log, the log file for the system and I was simply wondering if you really meant what you said.

When you need to log a message, call a function that uses sprintf() to put the message together. Open the file, write the message, close the file.

Sorry i dint say that, perhaps u confused between the OP and me. I just question u. So there no feature in the OS which basically logs any events for the applications, instead we need to write ower own. Thats fine.

Thanks a lot

ssharish

ssharish2005 62 Posting Whiz in Training

what actually are u trying to do with strfmon. You could so few things using sprintf family as well. As said before strfmon is not a standard function, no protability at all.

ssharish

ssharish2005 62 Posting Whiz in Training

im trying to sort my random numbers to odd numbers and even numbers,,

What u wanted to sort on both odd and even in the same array. Stars all over head lol

You can sort either on odd or even thats it. Perhaps u can have two array one sorted with even and one sorted with odd.

And dont use getch() function(instead use getchar() ) its a non standard function and main should return 0.

As people said u need to work around on your code indentation.

ssharish

ssharish2005 62 Posting Whiz in Training

Do you really want your operating system to do the logging? Or do you only need a file created with log entries in it?

WaltP I am pretty curious to know now, how would you make OS to log things for. As far i know it should have done by programmer itself isn't Or... am i going wrong somewhere

ssharish

ssharish2005 62 Posting Whiz in Training
conf_fd=open("/etc/example/server.conf",O_RDONLY);
read(conf_fd,conf,100);
close(conf_fd);

This reads the whole content of the file server.conf

/* Get server IP */
buffer=strtok(conf,";");
buffer1=strtok(NULL,";");

This breaks the string into two lines.

strtok(buffer,"=");
server=strtok(NULL,"=");
server_ip=inet_addr(server);

This gets IP address from the second line. To be more precise, in the second line, the things after '=' will be copied to server char *.

And perhaps i wouldn't really appriciate people using strtok function. Rather use fgets and sscanf function to tokensize the string. I guess there should be small tutorial on this web somewhere Dave has explaines about tokenisation of string. Have look at it.

ssharish

ssharish2005 62 Posting Whiz in Training

on what i know so far, u cant update the contents directly on to the file (well perhaps u can). Perhaps what i would suggest is read each line from the source file into a string. i.e line by line. See if u need to make some changes in that line. IF so do that changes in the string, and write that string back to a new file. And follow the same for all the lines in the source file and keep on copying it on to the new file. Once u have reached EOF on you old file. Delete the old file and rename the new file to the old filename.

That makes it easy for you.

ssharish

ssharish2005 62 Posting Whiz in Training

Probably this would give u what u want. Try use that function and see what u get on each return value.

LPCTSTR lpRootPathName,


ssharish

ssharish2005 62 Posting Whiz in Training

Have you tried chkdsk /f?
In a run box, type the command followed by the drive letter:
chkdsk /f d: for example.

Thanks Hughv, i did that but no success. What do u think might have taken me to this problem.

ssharish

ssharish2005 62 Posting Whiz in Training

Hello, I have this problem from past few week now, which i haven't rectified. Hope I get some suggestion from here.

I bought a new SATA2 Hdd 2 weeks before and there is no problem with that hard disk what so ever. The problem is with all my old hard disk which is SATA1. I made my new hard disk as my primary hard drive and installed windows XP on my new hard drive and kept my old one as my slave. Now the problem is that i cant access my old hard drive. I can browse the content of the drive, but when i try to access any files or directories i get a error message saying that "file has been corrupted". And i believe that its a problem with MBR.

What would you all say about. Is there any solution on how to get my data back from my old drive. I need them, i have got all my uni work in there.

Please help.

Thanks a lot

ssharish

ssharish2005 62 Posting Whiz in Training

I would really suggest to use the temp variable to swap two values. Cos the swapping variables without third variable such as using the arithmetic operators. This would really very help only when you wanted to swap unsigned integers. Apart from that it is not a recommended at all. If anything other unsigned integers you need to use the temp variable to swap. But in over all the latter would be efficient way of doing it.

ssharish

ssharish2005 62 Posting Whiz in Training

The link I posted is portable for both windows and *nix, but it was written in C++, not C. I have not read it closely but you might get ideas from that code.

Ohhh Thanks a lot Ancient D

ssharish

ssharish2005 62 Posting Whiz in Training

I'm getting a the error "passing arg1 of 'strcpy' makes pointer from integer without a cast....

This is where you get the error right

strcpy(make,newnode->make);
strcpy(model,newnode->model);

strcpy will get two char pointer (char *) as an argument. But you are passing just a (char). Which in fact is wrong. The char is internal converted to ASCII that is an int. Hence you get that an error.

In your case, since you are just copy a single char. You could just use a assignment operator to assign value. So for example you could replace the above statment by this

newnode->make = make;
newnode->model = model

strcpy are basically used to copy from one stirng to another, but not from one char to another. :) And offcouse others advice should be considered as well. In fact they are very important on improving your code.


ssharish

ssharish2005 62 Posting Whiz in Training

What happenes, the function throwstring() return the pointer to the first elements of the string const - which is located in heap- to the main. And printf use the base address to print of the full string till it hits NULL.

And as mentioned before. You should specify the int before main. By defualt compiler will assume that main return an int. But it is a good idea to specify. And a reture value to return 0;

const char *throwstring()
{
   return "I'm from throwstring func";
}
int main()
{
    char* throwstring();
    printf("%s\n", throwstring());
    
    return 0
}

ssharish

ssharish2005 62 Posting Whiz in Training

So where excatly are u stuck. Which part dont you understand. And what is your project you are doing?

ssharish

ssharish2005 62 Posting Whiz in Training

well, did u try Narue's solution, that could solve the problem as well.

That way you link the library directly to the object file of the code at linking time. And make sure the -lm should be at the end.

ssharish

ssharish2005 62 Posting Whiz in Training

looks like you havn't included the math.h header file. Do this at top

#include <math.h>

ssharish

ssharish2005 62 Posting Whiz in Training

So which part fo the code u dont understand well? Where did u get the code from?

ssharish

ssharish2005 62 Posting Whiz in Training

Thanks Ancient Dragon for your quick reply. But unfortunatly I am on *nix environment. So looking for a lib which can support unix config file :( I Should have mentioned that.

Or is there any better way that we can parse, rather than going all the down throught the file and finding out the tag?

ssharish

ssharish2005 62 Posting Whiz in Training

Just wondering, if anyone has got a library or good link to parse a config file. If not is there any effcient way of hanlding config file, where the config is just normal text file. Its not XML file or anything.

ssharish

ssharish2005 62 Posting Whiz in Training
ssharish2005 62 Posting Whiz in Training

Well, Turbo C is a very old compile which is no more support. Why dont u use some standard compile. I can understand that you on a windows environment. I would really sugguest to change compile which you trying to use to Dev-C++. It is pretty good and it good as well. With a nice IDE and stuff on top It uses Mingw port of GCC (GNU Compiler Collection) as it's compiler.

Google Dev-C++

ssharish

ssharish2005 62 Posting Whiz in Training

Why do you want to use text editor, when you have a good IDE's. Try Dev-C++.

ssharish2005

ssharish2005 62 Posting Whiz in Training

Hey thanks for the reply, ya i know this rule before. But why is it like that, there should be some reason, for coming up with this rule.

but anyway thanks for your rely.

ssharish

ssharish2005 62 Posting Whiz in Training
#include <stdio.h>
void printarray(const int arr[][3]);
int main()
{
    int arr[][3] = {{1,2,3},{4,5,6}};
    
    printarray(arr);
    
    getchar();
    return 0;
}

void printarray(const int arr[][3])
{
     int i,j;
     
     for(i=0;i<2;i++)
     {
        for(j=0;j<3;j++)
        printf("%d\t", arr[i][j]);
        
        printf("\n");
     }
        
}

This above code tends to give me a warning.

9 D:\cprogramming\arr1.c [Warning] passing argument 1 of 'printarray' from incompatible pointer type

but if i specify the arr in the main as const everything goes well.

But the same code with just 1D array it dons't tend to give me any warning, i dont understand why?

#include <stdio.h>
void printarray(const int arr[]);
int main()
{
    int arr[] = {1,2,3,4,5,6};
    
    printarray(arr);
    
    getchar();
    return 0;
}

void printarray(const int arr[])
{
     int i;
     
     for(i=0;i<6;i++)
        printf("%d\t", arr[i]);
}

Can anyone please explain why?

ssharish

ssharish2005 62 Posting Whiz in Training

Before doing anything about it. You should be having a good understanding of how to use stack and learn more about POSTFIXand INFIX. And google about POSTFix and INFIX algorithm.

You will some ton's links

ssharish2005

ssharish2005 62 Posting Whiz in Training

use sleep() function which is defined in time.h. It has only a resolution of 1 millisecond however. So if you say 5000 it would be 5sec i suppose.

ssharish2005

ssharish2005 62 Posting Whiz in Training
/* This is the explanaton 
  ch[0] = d & 0xFF;       --->    0000 0100 1011 0000
                                & 0000 0000 1111 1111
                                  ------------------- 
                                  0000 0000 1011 0000   --> ch[0]
                                  -------------------
 
  ch[1] = (d >> 8) & 0xFF  -->    0000 0000 0000 0100
                                & 0000 0000 1111 1111   
                                  -------------------
                                  0000 0000 0000 0100   -->  ch[1]
                                  -------------------
 
*/

ssharish2005

ssharish2005 62 Posting Whiz in Training

If you have any work experience before, you could think of automating some stuff from there. Like for example, I use to work leading petrochemical plants, there these scientists in the lab use manual values control, manual meter reading and temperature reading, cutting of supply and monitoring pressure and stuff. Most of the stuff in has been already automated through DCS system but still some of them need automating.

You could come with some sort of model or something which gives a basic idea for the industry and which would be more useful.

ssharish2005

ssharish2005 62 Posting Whiz in Training

Have a look at this tutorial http://en.wikipedia.org/wiki/LZW

ssharish2005

ssharish2005 62 Posting Whiz in Training
#include <stdio.h>
void foo(void *);
int main()
{
    char str[] = "This is a tes";
    
    foo(str);
    
    getchar();
    return 0;
}
void foo(void *str)
{
     printf("%s",(char*)str);
}
/* my output
This is a tes
*/

ssharish2005

ssharish2005 62 Posting Whiz in Training

Why do u want to place that in a 3 byte stream when that can fit in 2 byte stream.

ssharish2005

ssharish2005 62 Posting Whiz in Training

I am seeing this as a second post now. :)

ssharish2005

ssharish2005 62 Posting Whiz in Training

Hi,

Is there any way that we could read a graphics image data through a winsock lib or socket library.

Or how do we go ahead on reading a grahhics Data. When i try to read a graphics from my server it just return >>| or smething but it should have been something else.

Thank you

ssharish2005

ssharish2005 62 Posting Whiz in Training

I dont see the login behind this code. You have been all around. Why do u want to loop around with the string just to copy when u have a routines to do that.

What is that u wanted, explain it properly.

ssharish2005

ssharish2005 62 Posting Whiz in Training

And more using global variables is not a good idea, because of the above reasons. The value of the variable can be changes outside the function.

Why use array only for using a single element in an array. You could have just declared a single int variable.

ssharish2005

ssharish2005 62 Posting Whiz in Training

Hi,

Just wanted to if anybody here knows that how to handle the datatables which is returned from the server to by Ajax method , to be used by Javaascript. Searched though the interest, nothing help me.

How do i manipulate data table in Java script. The return data table from the server would be something like this [object object]. How do i work on it.

thanks very much

ssharish2005

ssharish2005 62 Posting Whiz in Training

Never through it would be so simple. It solved the problem. The mistake which i was doing is the not giving the correct password. There where no any complexity in my password.

The password which i was giving was just very simple.

Thanks very much for help.

ssharish2005

ssharish2005 62 Posting Whiz in Training

Hi ,

Having a small o big problem i dunno. Hope you all help me out is resolving this problem.

I installed windows 2003 and creating few users as soon as i created the domain. But my bad i just created just 2 users. After my first online updated from windows i dunno what happended it doesn't allow me to ate new domain users at all.

When i enter all the user details and say finish it comes up with an wired error telling that the "it donst satisfy the password length, complexity and history requirement". But as far as i know every thing is right to me.

When i found this problem as well, i though it would be a Domain policy problem or something and starting trying fixing the policies by the gpupdate /force command.

But still no success can any one please explain why is this and how to resolve this.

Please find the attachment for the error message

Thanks you

ssharish2005

ssharish2005 62 Posting Whiz in Training

Well, sorry forgot to mention that. It does display the cursor one position back. But the actual internal char is erased. But the char would be displayed. As Ancient Dragon said.

It would be useful if you just wanted to display the out put message but not use that same out message for further manipulation because the string is altered.

ssharish2005

ssharish2005 62 Posting Whiz in Training
#include <stdio.h>
int main()
{
    printf("Cursor one space back!!!\b");
    
    getchar();
    return 0;
}

ssharish2005

ssharish2005 62 Posting Whiz in Training

Hello guys,

Have a quite question anout Ajax. I am very new this topic,k so i dont much knowledge about this. Hope you can solve my problem. I was developing a web which use some ajax. But for some reason to wont call the server side script. I have tried the same thing with some simple example it works fine.

The problem which i am getting is here is the Object is undefined. But i have fillwed all the procedure. Here is my code.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%@ Register TagPrefix="MenuOpt" TagName="Menu" Src="~/MainHeader.ascx"%>
<%@ Register TagPrefix="Catopt" TagName="CatMenu" Src="~/CatagoryList.ascx"%>
<%@ Register TagPrefix="RightMenu" TagName="Menu" Src="~/RightMenuBar.ascx" %>
<%@ Register TagPrefix="BaseMenu" TagName="Menu" Src="~/BaseMenu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<link href="menustyle.css" rel="stylesheet" type="text/css" />
<html>
<head runat="server">
<title>Untitled Page</title>
<script src="utilites.js" type="text/javascript" language="javascript"></script>
<script src="menuscript.js" type="text/javascript" language="javascript"></script>
<script src="SeverCodeCall.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript" >
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<MenuOpt:Menu id="MainHeader" runat="server" />
 
</div>
<table align="center" border=0 style="width: 823px; border-top-width: thin; border-left-width: thin; border-left-color: darkred; border-bottom-width: thin; border-bottom-color: darkred; border-top-color: darkred; border-right-width: thin; border-right-color: darkred;">
<tr>
<td align="left" style="width:47px ; border-top-width: thin; border-left-width: thin; border-left-color: darkred; border-bottom-width: thin; border-bottom-color: darkred; border-top-color: darkred; border-right-width: thin; border-right-color: darkred; height: 22px; vertical-align: top;" >
<Catopt:CatMenu align="left" ID="Catagory" runat="server" />
</td>
<td style="width: 383px; border-top-width: thin; border-left-width: thin; border-left-color: darkred; border-bottom-width: thin; border-bottom-color: darkred; border-top-color: darkred; border-right-width: thin; border-right-color: darkred; height: 22px; vertical-align: top; text-align: left;" >
<div id="MBodyDiv"></div>
</td>
<td …
ssharish2005 62 Posting Whiz in Training

Hello guys,

I need this as sson as possible. Is there any tool which u know that can crack my VBA project password. I lost my VBA project passowrd[IMG]http://cboard.cprogramming.com/images/smilies/frown.gif[/IMG] And i am stuck with no progress. Is there any tool which i can crack or recover the passoword.

Thank you

ssharish2005

ssharish2005 62 Posting Whiz in Training

well i gues firefox. still but i dont get any thing like that in firefox. but only in iexplore. I will see wiht your solution. But thanks for the reply.

ssharish2005

ssharish2005 62 Posting Whiz in Training

Which version of IE are you runnig?

Version 6.0.

ssharish2005

ssharish2005 62 Posting Whiz in Training

Hello guys,

I been getting this error message from past few days when i close my Internet explore. Can any one explain me why that appearers whenever i closed Internet explore. For me it looks like it is something to do with the memory.

Please find the error message from the attached file called error.png

Thank you

ssharish2005

ssharish2005 62 Posting Whiz in Training

I'd use logmein, you think VPN is one thing but it's actually another. VPN let's clients connect to your network through a VPN tunnel, so you have a Virtual Netowork, which isn't the same as remote controlling a pc.

Thanks TheNNS for the reply. Well i know VPN is not a remote controller to control a PC. For this i use reomte desktop. I havn't tried logmenin. I will have to try that.

ssharish2005

ssharish2005 62 Posting Whiz in Training

I am not sure if your router has VPN passthrough but it is not easy to config it becuase you need to setup VPN tunnel etc and it is very slow if your broadband is <512k.

If you have static IP you may able to use VNC to access your PC from anywhere. Or try www.logmein.com

Thanks exp328 for the reply. well, my internet connection is 2Mb downsstream. I guess wouldn't that enough for the VNP. I am just trying to play along with it. i dont have any serious use of it.

And i dont have static IP address, i guess DHCP server for my IP address. My router acts as a DHCP router.

Sorry can i ask you what are those setting which need to be made in the router to access th vpn. So far what i have done is just open port 1723 to direct to my system.

ssharish2005

ssharish2005 62 Posting Whiz in Training

Hello guys,

Have a quick question on configuring a VPN. I was trying to configure VPN on my local machine (Win XP), so that i can access my machine anywhere else. Please correct me if i am wrong because i am just beginner in this.

In order to use the VPN we got to have VPN server configures on my local machines so that it can get all the incoming VPN calls from the clients. My problem is here.

This is how my home networking infrastructure look like. I have Linksys router(WRT54G). Behind that we got totally 3 system on IP ranges from 192.168.1.100 to 192.168.1.102. For the information i have opened the VPN port 1723 on my router to accept the incoming calls. Is there anymore ports which need to opened??

When i try to configure my VPN serve we will be asked to enter the IP address. I have read tutorials on the web but i dint understand. May be u all can help me. By default most the tutorial say that select the DHCP option. Some say to give static IP address.

Can any one explain me why do need to have an IP address there. Which is the best way is it Dynamic or static. More over from the remote Mahican how do I connect to my home PC. Which IP address should I use. Is that the IP address given …

ssharish2005 62 Posting Whiz in Training

Hello guys,

Have a quick question on configuring a VPN. I was trying to configure VPN on my local machine (Win XP), so that i can access my machine anywhere else. Please correct me if i am wrong because i am just beginner in this.

In order to use the VPN we got to have VPN server configures on my local machines so that it can get all the incoming VPN calls from the clients. My problem is here.

This is how my home networking infrastructure look like. I have Linksys router(WRT54G). Behind that we got totally 3 system on IP ranges from 192.168.1.100 to 192.168.1.102. For the information i have opened the VPN port 1723 on my router to accept the incoming calls. Is there anymore ports which need to opened??

When i try to configure my VPN serve we will be asked to enter the IP address. I have read tutorials on the web but i dint understand. May be u all can help me. By default most the tutorial say that select the DHCP option. Some say to give static IP address.

Can any one explain me why do need to have an IP address there. Which is the best way is it Dynamic or static. More over from the remote Mahican how do I connect to my home PC. Which IP address should I use. Is that the IP address given by the ISP. That is nothing much WAN …

ssharish2005 62 Posting Whiz in Training

there u go a good artical on Kdevelop configuration

http://docs.kde.org/development/en/kdevelop/kdevelop/setup.html#setup-format-general

ssharish2005