Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6594035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:45:32+00:00 2026-05-25T17:45:32+00:00

I am writing a program in C for windows using visual studio 2010. I

  • 0

I am writing a program in C for windows using visual studio 2010. I am using the swprintf_s function to write a formatted string to a wchar_t buffer.
I am getting the following errors when I attempt to write to a buffer that has been initialized.

Unhandled exception at 0x77b3fbda in svats.exe: 0xC00000FD: Stack overflow.

and sometimes

Unhandled exception at 0xfefefefe in svats.exe: 0xC0000005: Access violation.

Here is the code that produces the access violation.

wchar_t wBuff[1024] = L"b";
int test;
test = swprintf_s(wBuff,sizeof(wBuff),L"a%s","test");

and the code for the stack overflow.

wchar_t wBuff[1024] = L"b";
int test;
test = swprintf_s(wBuff,sizeof(wBuff),L"a%s",L"test");

Now the 2nd piece of code worked once, don’t know why.

Anyone know what the problem is?

PS. These files aren’t getting loaded, anyone know why? Is it because visual studio is 32 bit and my OS is 64 bit?

'svats.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\user32.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\lpk.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\usp10.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\sechost.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\sspicli.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\cryptbase.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\ws2_32.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\nsi.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\imm32.dll', Cannot find or open the PDB file
'svats.exe': Loaded 'C:\Windows\SysWOW64\msctf.dll', Cannot find or open the PDB file
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:45:32+00:00Added an answer on May 25, 2026 at 5:45 pm
    int main() {
      wchar_t wBuff[1024] = L"b";
      int test;
      test = swprintf_s(wBuff,_countof(wBuff),L"a%s","test");
    }
    

    This code would work instead. As stated by pmg, the second parameter should be 1024, not 2048. When you do sizeof, it will return the size in bytes. However swprintf_s expects the number of characters available in the buffer. You can either use _countof which essentially expands to the same as what has already been suggested to you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing a program in C# using Visual Studio 2010 and gets an
I'm writing an application using Visual Studio C++ 2010 to perform Data Acquisition and
I'm using 64 bit Windows 7 Pro and Visual Studio 2010 Pro. I'm trying
I am using Windows 7 and developing a chat-like application with Visual Studio 2010.
I just started writing a small application in C++ using Visual Studio C++ 2008
I'm interested in learning how to program using Microsoft's Visual C++ for Windows. In
Maybe you can help me... I am writing a program in Windows Mobile that
I'm writing a C program under Windows that should send an ENTER key to
I'm writing a program (for Mac OS X, using Objective-C) and I need to
I'm writing a program using python 2.6 and pyqt4. I want this program to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.