473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

c functon to set the gateway

I have a c function to set the gateway :-
Expand|Select|Wrap|Line Numbers
  1. if ((ofp = fopen(IF_CONF ".out", "w")) == NULL) 
  2. {
  3.         printf("Unable to open interface configuration file: %s.\n", strerror(errno));
  4.         fclose(fp);
  5.         return -1;
  6.  } 
  7.  
-->IF_CONF contains the path of the file to where the gateway ip should be written.


--->It's giving the output as Unable to open interface configuration file:Permission Denied.
-->I have set all the permission for the file IF_CONF..

-->how can i come out of this.

-->please any one help.
Aug 28 '07 #1
7 1794
sicarie
4,677 Expert Mod 4TB
I've never tried it that way, but I'm pretty sure your issue lies with IF_CONF ".out" and how there is nothing to join those two together. (Here I am guessing IF_CONF is a string or char*)

Have a look at this thread - I think the OP there is doing a similar thing that you want to be doing there (condensing that into a single string variable).
Aug 28 '07 #2
Banfa
9,065 Expert Mod 8TB
I'm pretty sure your issue lies with IF_CONF ".out" and how there is nothing to join those two together. (Here I am guessing IF_CONF is a string or char*)
No that is quite alright assuming that IF_CONF is defined something like

Expand|Select|Wrap|Line Numbers
  1. #define IF_CONF "c:\\SomeDirectory\\SomeFile"
  2.  
The C (and C++) compiler automatically contatinates strings that appear in the code with nothing but whitespace between them.

This is a useful feature as it allows you to easily split long strings across several code lines.

Try this

Expand|Select|Wrap|Line Numbers
  1. #include "stdio.h"
  2.  
  3. int main(int argc, char **argv)
  4. {
  5.     puts("He" "ll" "o " 
  6.          "Wo" "rl" "d!" );
  7.  
  8.     return 0;
  9. }
  10.  
Aug 28 '07 #3
sicarie
4,677 Expert Mod 4TB
No that is quite alright assuming that IF_CONF is defined something like

Expand|Select|Wrap|Line Numbers
  1. #define IF_CONF "c:\\SomeDirectory\\SomeFile"
  2.  
The C (and C++) compiler automatically contatinates strings that appear in the code with nothing but whitespace between them.

This is a useful feature as it allows you to easily split long strings across several code lines.

Try this

Expand|Select|Wrap|Line Numbers
  1. #include "stdio.h"
  2.  
  3. int main(int argc, char **argv)
  4. {
  5.     puts("He" "ll" "o " 
  6.          "Wo" "rl" "d!" );
  7.  
  8.     return 0;
  9. }
  10.  
Wow, that's interesting. Cool, though, you could have some fun with that. Thanks, Banfa.

So do you think the OP's issue is with the file permissions on what they are creating, or the directory it is being created in?
Aug 28 '07 #4
Banfa
9,065 Expert Mod 8TB
So do you think the OP's issue is with the file permissions on what they are creating, or the directory it is being created in?
Possibly or may be just an error in coding the file name, for instance \ instead of \\ or plain getting it wrong.
Aug 28 '07 #5
Possibly or may be just an error in coding the file name, for instance \ instead of \\ or plain getting it wrong.

Ya as Banfa told IF_CONF has been defined like
#define IF_CONF "/etc/sysconfig/network-scripts/ifcfg-eth0"


-->I am using linux machine.
-->I have given all the permission for that file.

So what do you think the solution is.
Aug 30 '07 #6
Banfa
9,065 Expert Mod 8TB
I trust you have tried to create/open /etc/sysconfig/network-scripts/ifcfg-eth0.out with a normal test editor to make sure you can.
Aug 30 '07 #7
No that is quite alright assuming that IF_CONF is defined something like

Expand|Select|Wrap|Line Numbers
  1. #define IF_CONF "c:\\SomeDirectory\\SomeFile"
  2.  
The C (and C++) compiler automatically contatinates strings that appear in the code with nothing but whitespace between them.

This is a useful feature as it allows you to easily split long strings across several code lines.

Try this

Expand|Select|Wrap|Line Numbers
  1. #include "stdio.h"
  2.  
  3. int main(int argc, char **argv)
  4. {
  5.     puts("He" "ll" "o " 
  6.          "Wo" "rl" "d!" );
  7.  
  8.     return 0;
  9. }
  10.  

ya you are correct.. it is like that oonly.
Sep 6 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Phillip J. Eby | last post by:
PEP: 333 Title: Python Web Server Gateway Interface v1.0 Version: $Revision: 1.1 $ Last-Modified: $Date: 2004/08/27 17:30:09 $ Author: Phillip J. Eby <pje at telecommunity.com> Discussions-To:...
7
by: Jim Hubbard | last post by:
First of all.....Happy New Year to you! I hope you have a successful and joyous new year. As for the HTTP Gateway examples.... I'm looking for some sample code that may illustrate techniques...
2
by: global | last post by:
Hi all, has anyone experience with XA transaction with twophase commit via gateway to host-db, my question is : where do I have to configure the parameters syncpoint=2 and connecttype=2 ? on...
1
by: global | last post by:
We have a Linux Server with UDB-EE 8.1.5, which is used as gateway for client connections to zOS-UDB. Our question : How many memory on the gateway does every connect user need ? We intend to...
0
by: Andy | last post by:
Hi, I'm currently developing my B2C application using ASP.NET. I have several questions regarding planning this application: In my application, I'll use my own shopping cart (developed totally...
0
by: bweaver4usenet | last post by:
Hi, all. I need some help getting a client up and running. Client Issue Client is using vc++ 6 and the Soap Tkt. Our web service is built with c# vs.net 2003. Can someone refer me to a sample I...
0
by: karpalmera | last post by:
We are currently migrating from OS/390 to Z/OS and our DB2 from DB2 4 to DB2 UDB8. However, our Oracle Database and Oracle gateway will remain the same..Oracle database is 7.2.3 and Oracle gateway is...
18
by: Grant Edwards | last post by:
Could whoever is responsible for the gateway that is grabbing my postings off of Usenet and e-mailing them out please fix the headers in the mail messages so that I don't get the bounce messages?...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.