Hi...
I got exception access violation at
add1=strcat("c:\\",add); statement...
why?wats solution?
void main()
{
char * output;
char * output2;
char * add;
char * add1;
int msgno;
msgno=1;
char name1[20];
char name[20];
strcpy(name,"name");
output2=new char[2];
itoa((msgno+1),output2,10);
output2[1]='\0';
output=new char[strlen(name)+2];
strcpy(output,name);
output=strcat(output,output2);
output[strlen(name)+1]='\0';
add=new char[(strlen(output))+5];
add=strcat(output,".txt");
add[(strlen(name))+5]='\0';
add1=new char[(strlen(add))+4];
add1=strcat("c:\\",add);.......................... ..............exception
add1[(strlen(name))+8]='\0';
FILE *obj1;
obj1=fopen(add,"w");
delete []output;
delete []output2;
delete []add;
delete []add1;
}
4 1886
HI,
Is the following line not throwing any warning?
add1=strcat("c:\\",add);.......................... ..............exce ption
Becos the stract takes the first parameter as a achar and what u are passing is a const char *.
Pass the string name (variable name) to which the string needs to be appended.
It will work fine
Thanks
Raghuram
HI,
Is the following line not throwing any warning?
add1=strcat("c:\\",add);.......................... ..............exce ption
Becos the stract takes the first parameter as a achar and what u are passing is a const char *.
Pass the string name (variable name) to which the string needs to be appended.
It will work fine
Thanks
Raghuram
Hi,
Syntax of strcat is: char * strcat(char *,const char *)
I changed code as follows..but still same error
char * str="c:\\";
add1=strcat(str,add);
what should i do to append "c:\\" to the beginning of string add?
Thanks,
Rupali
Hi,
Syntax of strcat is: char * strcat(char *,const char *)
I changed code as follows..but still same error
char * str="c:\\";
add1=strcat(str,add);
what should i do to append "c:\\" to the beginning of string add?
Thanks,
Rupali
strcat doesnot check for availability of space before appending.
when u give
char * str = "c:\\";
space is allocated just enough to hold c:\\
if you want more space say 100 or so you can use
char str[100];
strcpy(str,"c:\\");
and now use strcat(str,add);
strcat doesnot check for availability of space before appending.
when u give
char * str = "c:\\";
space is allocated just enough to hold c:\\
if you want more space say 100 or so you can use
char str[100];
strcpy(str,"c:\\");
and now use strcat(str,add);
it's working fine..NO ERROR...
Thanks,
Rupali
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Steven Reddie |
last post by:
I understand that access violations aren't part of the standard C++
exception handling support. On Windows, a particular MSVC compiler
option enables Microsoft's Structured Exception Handling...
|
by: Steven Reddie |
last post by:
In article <slrnbnj19j.av.juergen@monocerus.manannan.org>, Juergen
Heinzl wrote:
>In article <f93791bd.0309282133.650da850@posting.google.com>, Steven
Reddie wrote:
>> I understand that access...
|
by: Daniel |
last post by:
I want to write a method to remove the last node of the linked list.
But the error "Access Violation" exists and the error point to this
method.
What does it means by Access Violation and how can...
|
by: Microsoft News |
last post by:
I'm getting the following error when I shut down my C# .NET v1.1
application:
0xC0000005: Access violation reading location 0x73bc0000
This error didn't occur until I added a...
|
by: Bruce Pataki |
last post by:
I am creating an MFC application with activeX document server support. The
application runs perfectly fine when i run as a standalone application. But
when i run the application in Internet...
|
by: =?Utf-8?B?c2F0aGVlc2t1bWFy?= |
last post by:
In my project i have a component named PTS Engine which is developed in VC++
..Net 2003.
And it is migrated to VC++.NET 2005 version. Initially this migration
process has coded and tested in VC++...
|
by: jthep |
last post by:
I'm trying to get this piece of code I converted from C to work in C++ but I'm getting an access violation error. Problem occurs at line 61. Someone can help me with this?
The function...
|
by: Paavo Helde |
last post by:
Shawn <sfncook@gmail.comwrote in
news:6410e273-318e-44a0-9735-b922366ca1ab@w1g2000prd.googlegroups.com:
I bet you have some multithreading access error. Ensure that your threads
do not read or...
|
by: =?Utf-8?B?c29jYXRvYQ==?= |
last post by:
Hi,
I have a DLL in VC6, when a specific function is called it will spawns a
few threads and then return. The threads stay running and inside one of these
threads an event is created using the...
|
by: Martin |
last post by:
I have an intranet-only site running in Windows XPPro, IIS 5.1, PHP
5.2.5. I have not used or changed this site for several months - the
last time I worked with it, all was well.
When I tried it...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
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...
|
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...
|
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...
|
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...
| |