473,396 Members | 2,076 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,396 software developers and data experts.

C programming IN command line arguments

am having problem here with my code Plz Help me Here:

if((strcmp("-1", argv[1])==0) || (strcmp("-w", argv[1])==0))

strcpy(&File_name[0],argv[2]);

else

strcpy(&File_name[0],argv[1]);

Am getting this:
warning: incompatible implicit declaration of built-in function 'strcpy'.............

And THis ERROR:
undefined reference to `WinMain@16|
Jan 12 '12 #1
3 1519
Tassos Souris
152 100+
have you included string.h ?
Jan 12 '12 #2
weaknessforcats
9,208 Expert Mod 8TB
You need to include braces. Like this:

Expand|Select|Wrap|Line Numbers
  1. if((strcmp("-1", argv[1])==0) || (strcmp("-w", argv[1])==0))
  2. {
  3.  
  4. strcpy(&File_name[0],argv[2]);
  5.  }
  6. else
  7.  {
  8. strcpy(&File_name[0],argv[1]);
  9.  }
The WinMain error syas you are using Visuak C++ and have created a Windows project but you are not writing a Windows program.

Do this:
!) create a Win32 project.
2) when the wizard appears, do not click finish.
3) instead, select Applicaton settings
4) the select empty project and console application.
5) now click finish.
Jan 12 '12 #3
Tassos Souris
152 100+
actuyally if there is only one statement {} are not necessary :)
Jan 12 '12 #4

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

Similar topics

6
by: Hari | last post by:
can i have command line arguments in VS.NET applicatio? if yes how? Can i have some code snippets of the above functionality? I know we can acjieve this in console application form command...
1
by: rforman1 | last post by:
I have found many threads with this question asked and ostensibly answered, but none with an example of how exactly to do it. Help! I know that in order to set up the values of command line...
6
by: Jon Hewer | last post by:
hi i am writing a little script and currently implementing command line arguments following the guide by mark pilgrim from dive into python; ...
7
by: Steve M | last post by:
I'm trying to invoke a Java command-line program from my Python program on Windows XP. I cannot get the paths in one of the arguments to work right. The instructions for the program describe the...
25
by: David Bernier | last post by:
I'd like to pass on the command line two filenames. As for example: my_executable filename_1 filename_2 I haven't done any C programming with command line arguments so far. I'm familiar...
1
by: amirmira | last post by:
I would like to set command line arguments to a service at install time. I need to do this because I need to get information from different registry locations depending on my command line argument....
4
by: Roland | last post by:
Hi, I am developing a C++ project and want to pass some command line arguments in VS .NET 2003. I am in debug mode, the configuration is set to Debug and I entered my argument list in Project ->...
2
by: Milan | last post by:
Hi, Please guide me how to set command line argument and how to retrive command line argument. Senario: vb.net application should be able to execute from command prompt by passing login and...
5
by: Gregor H. | last post by:
In K&R (2nd edition) the authors published the following code for dealing with command line arguments (p. 117): while (--argc 0 && (*++argv) == '-') while (c = *++argv) switch (c) { case 'x':...
4
by: neha_chhatre | last post by:
please let me know if am using command line arguments, how to send arguments to a C program if i am working on ubuntu say for example suppose name of my program is prog.c if argc=3 then how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.